From b0843da89f65d4acb18d46a9776252af38bf6852 Mon Sep 17 00:00:00 2001 From: Burkhard Mittelbach Date: Thu, 4 Jul 2024 16:26:59 +0200 Subject: [PATCH] Ensure that Page actually implements Hash --- src/structures/paging/page.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/structures/paging/page.rs b/src/structures/paging/page.rs index e05b576d..445abd26 100644 --- a/src/structures/paging/page.rs +++ b/src/structures/paging/page.rs @@ -23,17 +23,17 @@ pub trait PageSize: Copy + Eq + PartialOrd + Ord + Sealed { pub trait NotGiantPageSize: PageSize {} /// A standard 4KiB page. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Size4KiB {} /// A “huge” 2MiB page. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Size2MiB {} /// A “giant” 1GiB page. /// /// (Only available on newer x86_64 CPUs.) -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Size1GiB {} impl PageSize for Size4KiB { @@ -429,6 +429,15 @@ impl fmt::Display for AddressNotAligned { mod tests { use super::*; + fn test_is_hash() {} + + #[test] + pub fn test_page_is_hash() { + test_is_hash::>(); + test_is_hash::>(); + test_is_hash::>(); + } + #[test] pub fn test_page_ranges() { let page_size = Size4KiB::SIZE;