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_expand/src/name.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/hir_expand/src') 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 { } pub fn new_lifetime(lt: &syntax::SyntaxToken) -> Name { - assert!(lt.kind() == syntax::SyntaxKind::LIFETIME); + assert_eq!(lt.kind(), syntax::SyntaxKind::LIFETIME); Name(Repr::Text(lt.text().clone())) } @@ -250,6 +250,8 @@ pub mod known { pub const SELF_PARAM: super::Name = super::Name::new_inline("self"); pub const SELF_TYPE: super::Name = super::Name::new_inline("Self"); + pub const STATIC_LIFETIME: super::Name = super::Name::new_inline("'static"); + #[macro_export] macro_rules! name { (self) => { @@ -258,6 +260,9 @@ pub mod known { (Self) => { $crate::name::known::SELF_TYPE }; + ('static) => { + $crate::name::known::STATIC_LIFETIME + }; ($ident:ident) => { $crate::name::known::$ident }; -- cgit v1.2.3