From 8b147624ff906a11134d2e18be071c6cb8ec4beb Mon Sep 17 00:00:00 2001 From: Jade Date: Wed, 12 May 2021 04:39:48 -0700 Subject: Add lowering of array lengths in types Now e.g. ```rust fn a(b: [u8; 2]) { } ``` will know about the length of b. --- crates/hir_ty/src/consts.rs | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 crates/hir_ty/src/consts.rs (limited to 'crates/hir_ty/src/consts.rs') diff --git a/crates/hir_ty/src/consts.rs b/crates/hir_ty/src/consts.rs deleted file mode 100644 index 0044b1cff..000000000 --- a/crates/hir_ty/src/consts.rs +++ /dev/null @@ -1,21 +0,0 @@ -//! Handling of concrete const values - -/// A concrete constant value -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum ConstScalar { - // for now, we only support the trivial case of constant evaluating the length of an array - // Note that this is u64 because the target usize may be bigger than our usize - Usize(u64), - - /// Case of an unknown value that rustc might know but we don't - Unknown, -} - -impl std::fmt::Display for ConstScalar { - fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { - match self { - ConstScalar::Usize(us) => write!(fmt, "{}", us), - ConstScalar::Unknown => write!(fmt, "_"), - } - } -} -- cgit v1.2.3