aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lower.rs
diff options
context:
space:
mode:
authorJade <[email protected]>2021-05-16 02:51:18 +0100
committerJade <[email protected]>2021-05-16 02:51:18 +0100
commitde0ed9860d86c3b905a967b1a7b5243499d32d67 (patch)
tree6c98701c319b32a52fdd6d39ce85c590aaf254f9 /crates/hir_ty/src/lower.rs
parent78d6b88f211cc9faf88815ce7fb1a91546cfce15 (diff)
Address final feedback
* rename ConstExtension->ConstExt * refactor a manual construction of a Const
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r--crates/hir_ty/src/lower.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index f7015e5ff..bd8bb6028 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -9,9 +9,7 @@ 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::{ 12use chalk_ir::{cast::Cast, fold::Shift, interner::HasInterner, Mutability, Safety};
13 cast::Cast, fold::Shift, interner::HasInterner, Mutability, Safety, Scalar, UintTy,
14};
15use hir_def::{ 13use hir_def::{
16 adt::StructKind, 14 adt::StructKind,
17 body::{Expander, LowerCtx}, 15 body::{Expander, LowerCtx},
@@ -31,16 +29,17 @@ use stdx::impl_from;
31use syntax::ast; 29use syntax::ast;
32 30
33use crate::{ 31use crate::{
32 consteval,
34 db::HirDatabase, 33 db::HirDatabase,
35 mapping::ToChalk, 34 mapping::ToChalk,
36 static_lifetime, to_assoc_type_id, to_chalk_trait_id, to_placeholder_idx, 35 static_lifetime, to_assoc_type_id, to_chalk_trait_id, to_placeholder_idx,
37 utils::{ 36 utils::{
38 all_super_trait_refs, associated_type_by_name_including_super_traits, generics, Generics, 37 all_super_trait_refs, associated_type_by_name_including_super_traits, generics, Generics,
39 }, 38 },
40 AliasEq, AliasTy, Binders, BoundVar, CallableSig, ConstData, ConstValue, DebruijnIndex, DynTy, 39 AliasEq, AliasTy, Binders, BoundVar, CallableSig, DebruijnIndex, DynTy, FnPointer, FnSig,
41 FnPointer, FnSig, FnSubst, ImplTraitId, Interner, OpaqueTy, PolyFnSig, ProjectionTy, 40 FnSubst, ImplTraitId, Interner, OpaqueTy, PolyFnSig, ProjectionTy, QuantifiedWhereClause,
42 QuantifiedWhereClause, QuantifiedWhereClauses, ReturnTypeImplTrait, ReturnTypeImplTraits, 41 QuantifiedWhereClauses, ReturnTypeImplTrait, ReturnTypeImplTraits, Substitution,
43 Substitution, TraitEnvironment, TraitRef, TraitRefExt, Ty, TyBuilder, TyKind, WhereClause, 42 TraitEnvironment, TraitRef, TraitRefExt, Ty, TyBuilder, TyKind, WhereClause,
44}; 43};
45 44
46#[derive(Debug)] 45#[derive(Debug)]
@@ -176,11 +175,7 @@ impl<'a> TyLoweringContext<'a> {
176 TypeRef::Array(inner, len) => { 175 TypeRef::Array(inner, len) => {
177 let inner_ty = self.lower_ty(inner); 176 let inner_ty = self.lower_ty(inner);
178 177
179 let const_len = ConstData { 178 let const_len = consteval::usize_const(len.as_usize());
180 ty: TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner),
181 value: ConstValue::Concrete(chalk_ir::ConcreteConst { interned: *len }),
182 }
183 .intern(&Interner);
184 179
185 TyKind::Array(inner_ty, const_len).intern(&Interner) 180 TyKind::Array(inner_ty, const_len).intern(&Interner)
186 } 181 }