diff options
author | Lukas Wirth <[email protected]> | 2020-12-11 12:49:32 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2020-12-11 23:56:52 +0000 |
commit | 11f86641829273e2b2b7023c2028bb475fce58ee (patch) | |
tree | 8633b96c3f812412ea6c19acb1b6a770292d4697 /crates/hir_expand | |
parent | 41321d96789ed918eebda02ada76758765d19d16 (diff) |
Add Lifetimes to the HIR
Diffstat (limited to 'crates/hir_expand')
-rw-r--r-- | crates/hir_expand/src/name.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/hir_expand/src/name.rs b/crates/hir_expand/src/name.rs index b26ffa1ef..583ed6142 100644 --- a/crates/hir_expand/src/name.rs +++ b/crates/hir_expand/src/name.rs | |||
@@ -38,7 +38,7 @@ impl Name { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | pub fn new_lifetime(lt: &syntax::SyntaxToken) -> Name { | 40 | pub fn new_lifetime(lt: &syntax::SyntaxToken) -> Name { |
41 | assert!(lt.kind() == syntax::SyntaxKind::LIFETIME); | 41 | assert_eq!(lt.kind(), syntax::SyntaxKind::LIFETIME); |
42 | Name(Repr::Text(lt.text().clone())) | 42 | Name(Repr::Text(lt.text().clone())) |
43 | } | 43 | } |
44 | 44 | ||
@@ -250,6 +250,8 @@ pub mod known { | |||
250 | pub const SELF_PARAM: super::Name = super::Name::new_inline("self"); | 250 | pub const SELF_PARAM: super::Name = super::Name::new_inline("self"); |
251 | pub const SELF_TYPE: super::Name = super::Name::new_inline("Self"); | 251 | pub const SELF_TYPE: super::Name = super::Name::new_inline("Self"); |
252 | 252 | ||
253 | pub const STATIC_LIFETIME: super::Name = super::Name::new_inline("'static"); | ||
254 | |||
253 | #[macro_export] | 255 | #[macro_export] |
254 | macro_rules! name { | 256 | macro_rules! name { |
255 | (self) => { | 257 | (self) => { |
@@ -258,6 +260,9 @@ pub mod known { | |||
258 | (Self) => { | 260 | (Self) => { |
259 | $crate::name::known::SELF_TYPE | 261 | $crate::name::known::SELF_TYPE |
260 | }; | 262 | }; |
263 | ('static) => { | ||
264 | $crate::name::known::STATIC_LIFETIME | ||
265 | }; | ||
261 | ($ident:ident) => { | 266 | ($ident:ident) => { |
262 | $crate::name::known::$ident | 267 | $crate::name::known::$ident |
263 | }; | 268 | }; |