aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer
diff options
context:
space:
mode:
authorJade <[email protected]>2021-05-12 12:39:48 +0100
committerJade <[email protected]>2021-05-13 05:22:46 +0100
commit8b147624ff906a11134d2e18be071c6cb8ec4beb (patch)
tree28df73a940497bc170ec9f080329657f4b1370b8 /crates/hir_ty/src/infer
parent312f1fe20a6a0a8e69834c66f51b9abc9db5e0ce (diff)
Add lowering of array lengths in types
Now e.g. ```rust fn a(b: [u8; 2]) { } ``` will know about the length of b.
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r--crates/hir_ty/src/infer/expr.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 2178ffd07..5e9420752 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -8,6 +8,7 @@ use hir_def::{
8 expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, 8 expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
9 path::{GenericArg, GenericArgs}, 9 path::{GenericArg, GenericArgs},
10 resolver::resolver_for_expr, 10 resolver::resolver_for_expr,
11 type_ref::ConstScalar,
11 AssocContainerId, FieldId, Lookup, 12 AssocContainerId, FieldId, Lookup,
12}; 13};
13use hir_expand::name::{name, Name}; 14use hir_expand::name::{name, Name};
@@ -15,9 +16,7 @@ use stdx::always;
15use syntax::ast::RangeOp; 16use syntax::ast::RangeOp;
16 17
17use crate::{ 18use crate::{
18 autoderef, 19 autoderef, dummy_usize_const,
19 consts::ConstScalar,
20 dummy_usize_const,
21 lower::lower_to_chalk_mutability, 20 lower::lower_to_chalk_mutability,
22 mapping::from_chalk, 21 mapping::from_chalk,
23 method_resolution, op, 22 method_resolution, op,
@@ -737,7 +736,8 @@ impl<'a> InferenceContext<'a> {
737 TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner), 736 TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner),
738 ), 737 ),
739 ); 738 );
740 // FIXME: support length for Repeat array expressions 739 // FIXME: we don't know the length here because hir Exprs don't actually
740 // get the value out of the AST, even though it is there.
741 None 741 None
742 } 742 }
743 }; 743 };