diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-12 15:49:43 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-12 15:49:43 +0100 |
commit | 312f1fe20a6a0a8e69834c66f51b9abc9db5e0ce (patch) | |
tree | 5b50f7359a6eaf482f01ade44dc12fd7bd1594ba /crates/hir_ty/src/lib.rs | |
parent | 1c927d2f8efdf8488d319b335db70b120dc11c37 (diff) | |
parent | f28c053c677203f4dd101222460081dd97c1f440 (diff) |
Merge #8799
8799: Add basic support for array lengths in types r=flodiebold a=lf-
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?
Co-authored-by: Jade <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 7 |
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; | |||
12 | mod chalk_ext; | 12 | mod chalk_ext; |
13 | mod infer; | 13 | mod infer; |
14 | mod interner; | 14 | mod interner; |
15 | mod consts; | ||
15 | mod lower; | 16 | mod lower; |
16 | mod mapping; | 17 | mod mapping; |
17 | mod op; | 18 | mod op; |
@@ -39,7 +40,7 @@ use chalk_ir::{ | |||
39 | }; | 40 | }; |
40 | use hir_def::{expr::ExprId, type_ref::Rawness, TypeParamId}; | 41 | use hir_def::{expr::ExprId, type_ref::Rawness, TypeParamId}; |
41 | 42 | ||
42 | use crate::{db::HirDatabase, display::HirDisplay, utils::generics}; | 43 | use crate::{consts::ConstScalar, db::HirDatabase, display::HirDisplay, utils::generics}; |
43 | 44 | ||
44 | pub use autoderef::autoderef; | 45 | pub use autoderef::autoderef; |
45 | pub use builder::TyBuilder; | 46 | pub 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 | } |