diff options
-rw-r--r-- | crates/hir_ty/src/consts.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/crates/hir_ty/src/consts.rs b/crates/hir_ty/src/consts.rs index 77d2a7a05..0044b1cff 100644 --- a/crates/hir_ty/src/consts.rs +++ b/crates/hir_ty/src/consts.rs | |||
@@ -4,7 +4,8 @@ | |||
4 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 4 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
5 | pub enum ConstScalar { | 5 | pub enum ConstScalar { |
6 | // for now, we only support the trivial case of constant evaluating the length of an array | 6 | // for now, we only support the trivial case of constant evaluating the length of an array |
7 | Usize(usize), | 7 | // Note that this is u64 because the target usize may be bigger than our usize |
8 | Usize(u64), | ||
8 | 9 | ||
9 | /// Case of an unknown value that rustc might know but we don't | 10 | /// Case of an unknown value that rustc might know but we don't |
10 | Unknown, | 11 | Unknown, |
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 9aec8a236..a7e720f88 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -746,7 +746,7 @@ impl<'a> InferenceContext<'a> { | |||
746 | ty: TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner), | 746 | ty: TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner), |
747 | value: ConstValue::Concrete(chalk_ir::ConcreteConst { | 747 | value: ConstValue::Concrete(chalk_ir::ConcreteConst { |
748 | interned: len | 748 | interned: len |
749 | .map(|len| ConstScalar::Usize(len)) | 749 | .map(|len| ConstScalar::Usize(len as u64)) |
750 | .unwrap_or(ConstScalar::Unknown), | 750 | .unwrap_or(ConstScalar::Unknown), |
751 | }), | 751 | }), |
752 | }; | 752 | }; |