diff options
author | Lukas Wirth <[email protected]> | 2021-04-05 21:08:16 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-04-06 09:45:30 +0100 |
commit | 96756f1b1df4729fd00ca96a59971b3997c91934 (patch) | |
tree | 1daa47d67081772ed1a61b0db13ff041337ddf8b /crates/hir_ty/src/lib.rs | |
parent | 4bc8a018302d53951ae855ba57d07095a16ef182 (diff) |
Add Lifetime to TyKind::Ref
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index c3ec12352..1dfe2075c 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -165,16 +165,16 @@ impl CallableSig { | |||
165 | } | 165 | } |
166 | 166 | ||
167 | impl Ty { | 167 | impl Ty { |
168 | pub fn as_reference(&self) -> Option<(&Ty, Mutability)> { | 168 | pub fn as_reference(&self) -> Option<(&Ty, Lifetime, Mutability)> { |
169 | match self.kind(&Interner) { | 169 | match self.kind(&Interner) { |
170 | TyKind::Ref(mutability, ty) => Some((ty, *mutability)), | 170 | TyKind::Ref(mutability, lifetime, ty) => Some((ty, *lifetime, *mutability)), |
171 | _ => None, | 171 | _ => None, |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | pub fn as_reference_or_ptr(&self) -> Option<(&Ty, Rawness, Mutability)> { | 175 | pub fn as_reference_or_ptr(&self) -> Option<(&Ty, Rawness, Mutability)> { |
176 | match self.kind(&Interner) { | 176 | match self.kind(&Interner) { |
177 | TyKind::Ref(mutability, ty) => Some((ty, Rawness::Ref, *mutability)), | 177 | TyKind::Ref(mutability, _, ty) => Some((ty, Rawness::Ref, *mutability)), |
178 | TyKind::Raw(mutability, ty) => Some((ty, Rawness::RawPtr, *mutability)), | 178 | TyKind::Raw(mutability, ty) => Some((ty, Rawness::RawPtr, *mutability)), |
179 | _ => None, | 179 | _ => None, |
180 | } | 180 | } |
@@ -183,7 +183,7 @@ impl Ty { | |||
183 | pub fn strip_references(&self) -> &Ty { | 183 | pub fn strip_references(&self) -> &Ty { |
184 | let mut t: &Ty = self; | 184 | let mut t: &Ty = self; |
185 | 185 | ||
186 | while let TyKind::Ref(_mutability, ty) = t.kind(&Interner) { | 186 | while let TyKind::Ref(_mutability, _lifetime, ty) = t.kind(&Interner) { |
187 | t = ty; | 187 | t = ty; |
188 | } | 188 | } |
189 | 189 | ||