From 2fa0ea61920590dcc331d9740a25720e025b9d66 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 9 Mar 2025 20:59:21 -0700 Subject: [PATCH] make FillInDefaultedGenerics work with `Size`s and not just `Type`s --- crates/fayalite/src/ty.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/fayalite/src/ty.rs b/crates/fayalite/src/ty.rs index 69080c9..55c7e8f 100644 --- a/crates/fayalite/src/ty.rs +++ b/crates/fayalite/src/ty.rs @@ -11,6 +11,7 @@ use crate::{ intern::{Intern, Interned}, reset::{AsyncReset, Reset, SyncReset}, source_location::SourceLocation, + util::ConstUsize, }; use std::{fmt, hash::Hash, iter::FusedIterator, ops::Index}; @@ -166,7 +167,7 @@ impl MatchVariantAndInactiveScope for MatchVariantWith } pub trait FillInDefaultedGenerics { - type Type: Type; + type Type; fn fill_in_defaulted_generics(self) -> Self::Type; } @@ -178,6 +179,22 @@ impl FillInDefaultedGenerics for T { } } +impl FillInDefaultedGenerics for usize { + type Type = usize; + + fn fill_in_defaulted_generics(self) -> Self::Type { + self + } +} + +impl FillInDefaultedGenerics for ConstUsize { + type Type = ConstUsize; + + fn fill_in_defaulted_generics(self) -> Self::Type { + self + } +} + mod sealed { pub trait TypeOrDefaultSealed {} pub trait BaseTypeSealed {}