diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-06 09:52:02 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-06 09:52:02 +0100 |
commit | 047b5313013383fc4fafaef6d6d8d6a64549e3cb (patch) | |
tree | f4951c835dd6f4840ae02ba5c06d5da44aedae94 /crates/hir_ty/src/lower.rs | |
parent | 4bc8a018302d53951ae855ba57d07095a16ef182 (diff) | |
parent | 08dc69599efb4961319c0118b789d3abb264b7fa (diff) |
Merge #8359
8359: Add Lifetime to TyKind::Ref and DynTy r=flodiebold a=Veykril
CC #8313
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r-- | crates/hir_ty/src/lower.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 3cbb6ad54..df6619af3 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -27,7 +27,7 @@ use stdx::impl_from; | |||
27 | 27 | ||
28 | use crate::{ | 28 | use crate::{ |
29 | db::HirDatabase, | 29 | db::HirDatabase, |
30 | to_assoc_type_id, to_chalk_trait_id, to_placeholder_idx, | 30 | static_lifetime, to_assoc_type_id, to_chalk_trait_id, to_placeholder_idx, |
31 | traits::chalk::{Interner, ToChalk}, | 31 | traits::chalk::{Interner, ToChalk}, |
32 | utils::{ | 32 | utils::{ |
33 | all_super_trait_refs, associated_type_by_name_including_super_traits, generics, | 33 | all_super_trait_refs, associated_type_by_name_including_super_traits, generics, |
@@ -174,7 +174,9 @@ impl<'a> TyLoweringContext<'a> { | |||
174 | } | 174 | } |
175 | TypeRef::Reference(inner, _, mutability) => { | 175 | TypeRef::Reference(inner, _, mutability) => { |
176 | let inner_ty = self.lower_ty(inner); | 176 | let inner_ty = self.lower_ty(inner); |
177 | TyKind::Ref(lower_to_chalk_mutability(*mutability), inner_ty).intern(&Interner) | 177 | let lifetime = static_lifetime(); |
178 | TyKind::Ref(lower_to_chalk_mutability(*mutability), lifetime, inner_ty) | ||
179 | .intern(&Interner) | ||
178 | } | 180 | } |
179 | TypeRef::Placeholder => TyKind::Error.intern(&Interner), | 181 | TypeRef::Placeholder => TyKind::Error.intern(&Interner), |
180 | TypeRef::Fn(params, is_varargs) => { | 182 | TypeRef::Fn(params, is_varargs) => { |
@@ -198,7 +200,7 @@ impl<'a> TyLoweringContext<'a> { | |||
198 | ) | 200 | ) |
199 | }); | 201 | }); |
200 | let bounds = crate::make_only_type_binders(1, bounds); | 202 | let bounds = crate::make_only_type_binders(1, bounds); |
201 | TyKind::Dyn(DynTy { bounds }).intern(&Interner) | 203 | TyKind::Dyn(DynTy { bounds, lifetime: static_lifetime() }).intern(&Interner) |
202 | } | 204 | } |
203 | TypeRef::ImplTrait(bounds) => { | 205 | TypeRef::ImplTrait(bounds) => { |
204 | match self.impl_trait_mode { | 206 | match self.impl_trait_mode { |
@@ -390,6 +392,7 @@ impl<'a> TyLoweringContext<'a> { | |||
390 | ))), | 392 | ))), |
391 | ), | 393 | ), |
392 | ), | 394 | ), |
395 | lifetime: static_lifetime(), | ||
393 | }; | 396 | }; |
394 | TyKind::Dyn(dyn_ty).intern(&Interner) | 397 | TyKind::Dyn(dyn_ty).intern(&Interner) |
395 | }; | 398 | }; |