Skip to content

Commit f28c053

Browse files
committed
address review by @eddyb
1 parent dc63fea commit f28c053

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

crates/hir_ty/src/consts.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
55
pub enum ConstScalar {
66
// 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),
89

910
/// Case of an unknown value that rustc might know but we don't
1011
Unknown,

crates/hir_ty/src/infer/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ impl<'a> InferenceContext<'a> {
746746
ty: TyKind::Scalar(Scalar::Uint(UintTy::Usize)).intern(&Interner),
747747
value: ConstValue::Concrete(chalk_ir::ConcreteConst {
748748
interned: len
749-
.map(|len| ConstScalar::Usize(len))
749+
.map(|len| ConstScalar::Usize(len as u64))
750750
.unwrap_or(ConstScalar::Unknown),
751751
}),
752752
};

0 commit comments

Comments
 (0)