aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r--crates/hir_ty/src/lower.rs26
1 files changed, 16 insertions, 10 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 9751b45e4..f7015e5ff 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -9,7 +9,9 @@ use std::cell::{Cell, RefCell};
9use std::{iter, sync::Arc}; 9use std::{iter, sync::Arc};
10 10
11use base_db::CrateId; 11use base_db::CrateId;
12use chalk_ir::{cast::Cast, fold::Shift, interner::HasInterner, Mutability, Safety}; 12use chalk_ir::{
13 cast::Cast, fold::Shift, interner::HasInterner, Mutability, Safety, Scalar, UintTy,
14};
13use hir_def::{ 15use hir_def::{
14 adt::StructKind, 16 adt::StructKind,
15 body::{Expander, LowerCtx}, 17 body::{Expander, LowerCtx},
@@ -30,16 +32,15 @@ use syntax::ast;
30 32
31use crate::{ 33use crate::{
32 db::HirDatabase, 34 db::HirDatabase,
33 dummy_usize_const,
34 mapping::ToChalk, 35 mapping::ToChalk,
35 static_lifetime, to_assoc_type_id, to_chalk_trait_id, to_placeholder_idx, 36 static_lifetime, to_assoc_type_id, to_chalk_trait_id, to_placeholder_idx,
36 utils::{ 37 utils::{
37 all_super_trait_refs, associated_type_by_name_including_super_traits, generics, Generics, 38 all_super_trait_refs, associated_type_by_name_including_super_traits, generics, Generics,
38 }, 39 },
39 AliasEq, AliasTy, Binders, BoundVar, CallableSig, DebruijnIndex, DynTy, FnPointer, FnSig, 40 AliasEq, AliasTy, Binders, BoundVar, CallableSig, ConstData, ConstValue, DebruijnIndex, DynTy,
40 FnSubst, ImplTraitId, Interner, OpaqueTy, PolyFnSig, ProjectionTy, QuantifiedWhereClause, 41 FnPointer, FnSig, FnSubst, ImplTraitId, Interner, OpaqueTy, PolyFnSig, ProjectionTy,
41 QuantifiedWhereClauses, ReturnTypeImplTrait, ReturnTypeImplTraits, Substitution, 42 QuantifiedWhereClause, QuantifiedWhereClauses, ReturnTypeImplTrait, ReturnTypeImplTraits,
42 TraitEnvironment, TraitRef, TraitRefExt, Ty, TyBuilder, TyKind, WhereClause, 43 Substitution, TraitEnvironment, TraitRef, TraitRefExt, Ty, TyBuilder, TyKind, WhereClause,
43}; 44};
44 45
45#[derive(Debug)] 46#[derive(Debug)]
@@ -172,11 +173,16 @@ impl<'a> TyLoweringContext<'a> {
172 let inner_ty = self.lower_ty(inner); 173 let inner_ty = self.lower_ty(inner);
173 TyKind::Raw(lower_to_chalk_mutability(*mutability), inner_ty).intern(&Interner) 174 TyKind::Raw(lower_to_chalk_mutability(*mutability), inner_ty).intern(&Interner)
174 } 175 }
175 TypeRef::Array(inner) => { 176 TypeRef::Array(inner, len) => {
176 let inner_ty = self.lower_ty(inner); 177 let inner_ty = self.lower_ty(inner);
177 // FIXME: we don't have length info here because we don't store an expression for 178
178 // the length 179 let const_len = ConstData {
179 TyKind::Array(inner_ty, dummy_usize_const()).intern(&Interner) 180 ty: TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner),
181 value: ConstValue::Concrete(chalk_ir::ConcreteConst { interned: *len }),
182 }
183 .intern(&Interner);
184
185 TyKind::Array(inner_ty, const_len).intern(&Interner)
180 } 186 }
181 TypeRef::Slice(inner) => { 187 TypeRef::Slice(inner) => {
182 let inner_ty = self.lower_ty(inner); 188 let inner_ty = self.lower_ty(inner);