aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/type_ref.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/type_ref.rs')
-rw-r--r--crates/hir_def/src/type_ref.rs10
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.
3use hir_expand::name::Name; 3use hir_expand::name::Name;
4use syntax::{ast, SyntaxToken}; 4use syntax::ast;
5 5
6use crate::{body::LowerCtx, path::Path}; 6use 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(&lt));
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 }