aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorJade <[email protected]>2021-05-11 13:06:33 +0100
committerJade <[email protected]>2021-05-11 13:25:19 +0100
commitdc63fea427280ff278bf89a8b9c78df606009910 (patch)
tree5fb6eae3df58a7c5bc3bc5a1220dd9a5d6d3ea86 /crates/hir_ty/src/lib.rs
parent77f0c92fd8311bccc001ddaf9eb72662d35e9836 (diff)
Add basic support for array lengths in types
This recognizes `let a = [1u8, 2, 3]` as having type `[u8; 3]` instead of the previous `[u8; _]`. Byte strings and `[0u8; 2]` kinds of range array declarations are unsupported as before. I don't know why a bunch of our rustc tests had single quotes inside strings un-escaped by `UPDATE_EXPECT=1 cargo t`, but I don't think it's bad? Maybe something in a nightly?
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 0505fa4ae..d23eff513 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -12,6 +12,7 @@ mod chalk_db;
12mod chalk_ext; 12mod chalk_ext;
13mod infer; 13mod infer;
14mod interner; 14mod interner;
15mod consts;
15mod lower; 16mod lower;
16mod mapping; 17mod mapping;
17mod op; 18mod op;
@@ -39,7 +40,7 @@ use chalk_ir::{
39}; 40};
40use hir_def::{expr::ExprId, type_ref::Rawness, TypeParamId}; 41use hir_def::{expr::ExprId, type_ref::Rawness, TypeParamId};
41 42
42use crate::{db::HirDatabase, display::HirDisplay, utils::generics}; 43use crate::{consts::ConstScalar, db::HirDatabase, display::HirDisplay, utils::generics};
43 44
44pub use autoderef::autoderef; 45pub use autoderef::autoderef;
45pub use builder::TyBuilder; 46pub use builder::TyBuilder;
@@ -250,7 +251,9 @@ pub fn dummy_usize_const() -> Const {
250 let usize_ty = chalk_ir::TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner); 251 let usize_ty = chalk_ir::TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner);
251 chalk_ir::ConstData { 252 chalk_ir::ConstData {
252 ty: usize_ty, 253 ty: usize_ty,
253 value: chalk_ir::ConstValue::Concrete(chalk_ir::ConcreteConst { interned: () }), 254 value: chalk_ir::ConstValue::Concrete(chalk_ir::ConcreteConst {
255 interned: ConstScalar::Unknown,
256 }),
254 } 257 }
255 .intern(&Interner) 258 .intern(&Interner)
256} 259}