diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-16 17:08:03 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-16 17:08:03 +0000 |
commit | 067067a6c11bb5afda98f5af14bfdec4744e7812 (patch) | |
tree | 1c0b6c4c78ee040ebdf818dada804fce311382a6 /crates/hir_def/src/type_ref.rs | |
parent | 63bbdb31e5148c804bbf940963c9c8f3481ad258 (diff) | |
parent | dd496223f50232fe98312ee8edc89eb4b5ee3d85 (diff) |
Merge #6896
6896: Node-ify lifetimes r=jonas-schievink a=Veykril
Let's see if this passes the tests 🤞
Depends on https://github.com/rust-analyzer/ungrammar/pull/15
Co-authored-by: Jonas Schievink <[email protected]>
Co-authored-by: Jonas Schievink <[email protected]>
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_def/src/type_ref.rs')
-rw-r--r-- | crates/hir_def/src/type_ref.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_def/src/type_ref.rs b/crates/hir_def/src/type_ref.rs index 347ceabb9..ae93d0d10 100644 --- a/crates/hir_def/src/type_ref.rs +++ b/crates/hir_def/src/type_ref.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! HIR for references to types. Paths in these are not yet resolved. They can | 1 | //! HIR for references to types. Paths in these are not yet resolved. They can |
2 | //! be directly created from an ast::TypeRef, without further queries. | 2 | //! be directly created from an ast::TypeRef, without further queries. |
3 | use hir_expand::name::Name; | 3 | use hir_expand::name::Name; |
4 | use syntax::{ast, SyntaxToken}; | 4 | use syntax::ast; |
5 | 5 | ||
6 | use crate::{body::LowerCtx, path::Path}; | 6 | use crate::{body::LowerCtx, path::Path}; |
7 | 7 | ||
@@ -80,8 +80,8 @@ impl LifetimeRef { | |||
80 | LifetimeRef { name } | 80 | LifetimeRef { name } |
81 | } | 81 | } |
82 | 82 | ||
83 | pub(crate) fn from_token(token: SyntaxToken) -> Self { | 83 | pub(crate) fn new(lifetime: &ast::Lifetime) -> Self { |
84 | LifetimeRef { name: Name::new_lifetime(&token) } | 84 | LifetimeRef { name: Name::new_lifetime(lifetime) } |
85 | } | 85 | } |
86 | 86 | ||
87 | pub fn missing() -> LifetimeRef { | 87 | pub fn missing() -> LifetimeRef { |
@@ -127,7 +127,7 @@ impl TypeRef { | |||
127 | } | 127 | } |
128 | ast::Type::RefType(inner) => { | 128 | ast::Type::RefType(inner) => { |
129 | let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); | 129 | let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); |
130 | let lifetime = inner.lifetime_token().map(|t| LifetimeRef::from_token(t)); | 130 | let lifetime = inner.lifetime().map(|lt| LifetimeRef::new(<)); |
131 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); | 131 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); |
132 | TypeRef::Reference(Box::new(inner_ty), lifetime, mutability) | 132 | TypeRef::Reference(Box::new(inner_ty), lifetime, mutability) |
133 | } | 133 | } |
@@ -259,7 +259,7 @@ impl TypeBound { | |||
259 | } | 259 | } |
260 | ast::TypeBoundKind::ForType(_) => TypeBound::Error, // FIXME ForType | 260 | ast::TypeBoundKind::ForType(_) => TypeBound::Error, // FIXME ForType |
261 | ast::TypeBoundKind::Lifetime(lifetime) => { | 261 | ast::TypeBoundKind::Lifetime(lifetime) => { |
262 | TypeBound::Lifetime(LifetimeRef::from_token(lifetime)) | 262 | TypeBound::Lifetime(LifetimeRef::new(&lifetime)) |
263 | } | 263 | } |
264 | } | 264 | } |
265 | } | 265 | } |