mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Add Lifetimes to the HIR
This commit is contained in:
parent
41321d9678
commit
11f8664182
16 changed files with 249 additions and 96 deletions
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue