diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-12 14:35:38 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-12 14:35:38 +0000 |
commit | 479d1f7eec22c3564867223e2093f14774092528 (patch) | |
tree | 0b7b74f69d33ca5c86267ace1ac38c2c15248e50 /crates/hir_def/src/path | |
parent | 64a1c9810d5979cfd0fe6e7c385d9ca3caac2163 (diff) | |
parent | 11f86641829273e2b2b7023c2028bb475fce58ee (diff) |
Merge #6818
6818: Add Lifetimes to the HIR r=matklad a=Veykril
This doesn't handle resolve yet as I don't know yet how that will be used. I'll get to that once I start moving the lifetime reference PR to the hir.
This also adds a new `hir` name type for lifetimes and labels, `hir::LifetimeName`.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_def/src/path')
-rw-r--r-- | crates/hir_def/src/path/lower.rs | 12 |
1 files changed, 9 insertions, 3 deletions
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; | |||
15 | use crate::{ | 15 | use crate::{ |
16 | body::LowerCtx, | 16 | body::LowerCtx, |
17 | path::{GenericArg, GenericArgs, ModPath, Path, PathKind}, | 17 | path::{GenericArg, GenericArgs, ModPath, Path, PathKind}, |
18 | type_ref::{TypeBound, TypeRef}, | 18 | type_ref::{LifetimeRef, TypeBound, TypeRef}, |
19 | }; | 19 | }; |
20 | 20 | ||
21 | pub(super) use lower_use::lower_use_tree; | 21 | pub(super) use lower_use::lower_use_tree; |
@@ -170,8 +170,14 @@ pub(super) fn lower_generic_args( | |||
170 | bindings.push(AssociatedTypeBinding { name, type_ref, bounds }); | 170 | bindings.push(AssociatedTypeBinding { name, type_ref, bounds }); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | // Lifetimes and constants are ignored for now. | 173 | ast::GenericArg::LifetimeArg(lifetime_arg) => { |
174 | ast::GenericArg::LifetimeArg(_) | ast::GenericArg::ConstArg(_) => (), | 174 | if let Some(lifetime) = lifetime_arg.lifetime_token() { |
175 | let lifetime_ref = LifetimeRef::from_token(lifetime); | ||
176 | args.push(GenericArg::Lifetime(lifetime_ref)) | ||
177 | } | ||
178 | } | ||
179 | // constants are ignored for now. | ||
180 | ast::GenericArg::ConstArg(_) => (), | ||
175 | } | 181 | } |
176 | } | 182 | } |
177 | 183 | ||