From e33f99786ba02f21f5ce34f638c57a3465ab0d17 Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Sun, 11 Jul 2021 21:21:48 +0300 Subject: [PATCH] [sq] use static_assertions --- Cargo.lock | 7 +++++++ nucleus/Cargo.toml | 1 + nucleus/src/arch/aarch64/memory/mmu.rs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 545dca4..7982fec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,6 +86,12 @@ dependencies = [ "syn", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "syn" version = "1.0.73" @@ -132,6 +138,7 @@ dependencies = [ "qemu-exit", "r0", "snafu", + "static_assertions", "tock-registers", "usize_conversions", "ux", diff --git a/nucleus/Cargo.toml b/nucleus/Cargo.toml index 3eb0c5c..be09dff 100644 --- a/nucleus/Cargo.toml +++ b/nucleus/Cargo.toml @@ -34,3 +34,4 @@ bit_field = "0.10.1" bitflags = "1.2" cfg-if = "1.0" snafu = { version = "0.7.0-beta.0", default-features = false } +static_assertions = "1.1.0" diff --git a/nucleus/src/arch/aarch64/memory/mmu.rs b/nucleus/src/arch/aarch64/memory/mmu.rs index fee7917..a63820d 100644 --- a/nucleus/src/arch/aarch64/memory/mmu.rs +++ b/nucleus/src/arch/aarch64/memory/mmu.rs @@ -341,7 +341,7 @@ impl HierarchicalPageLevel for L3PageTable { const TABLE_BITS: usize = 9; const INDEX_MASK: usize = (1 << TABLE_BITS) - 1; -static_assert!(INDEX_MASK == 0x1ff); +static_assertions::const_assert!(INDEX_MASK == 0x1ff); // @todo Table in mmu.rs /// MMU address translation table.