From 6634115d70dc6fc3b4830bd33fcb506037693dfd Mon Sep 17 00:00:00 2001 From: gHashTag Date: Sun, 14 Jun 2026 17:29:21 +0000 Subject: [PATCH] compiler: per-enum allow(dead_code) for HIR/FPGA grammar enums (warnings 655->647). Closes #1129 --- bootstrap/src/compiler.rs | 18 ++++++++++++++++++ docs/NOW.md | 7 +++++++ scripts/warnings-baseline.sh | 10 +++++----- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/bootstrap/src/compiler.rs b/bootstrap/src/compiler.rs index 5370575bf..2514701e9 100644 --- a/bootstrap/src/compiler.rs +++ b/bootstrap/src/compiler.rs @@ -8096,6 +8096,17 @@ impl RustCodegen { // ============================================================================ #[derive(Debug, Clone, PartialEq)] +// Variant S (#969 dead-code audit, HIR/FPGA grammar layer): the Hardware IR +// node-kind enums below model the full target HDL/FPGA grammar surface +// (clock/reset kinds, edge sensitivity, always-block statement kinds, memory +// kinds, clock-domain-crossing and FIFO strategies). Several variants are not +// yet constructed by the current lowering passes, so each emits a +// `never constructed` dead_code warning -- but they are an intentional, +// spec-complete AST surface kept for the Phase-0 FPGA foundation, not dead +// code. A targeted per-enum allow documents that without removing any variant +// or weakening the type; same conservative annotate-not-delete pattern as the +// #1111 / #1122 host slices. Scoped narrowly to these enums (NOT the file). +#[allow(dead_code)] pub enum HwType { Bits(u32), UInt(u32), @@ -8110,12 +8121,14 @@ pub enum HwType { } #[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] pub enum HwResetKind { Async, Sync, } #[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] pub enum HwResetPolarity { ActiveHigh, ActiveLow, @@ -8208,6 +8221,7 @@ pub struct HirAssign { } #[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] pub enum HwEdge { Posedge, Negedge, @@ -8223,6 +8237,7 @@ pub struct HirAlwaysBlock { } #[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] pub enum HirAlwaysStmtKind { BlockingAssign, NonBlockingAssign, @@ -8250,6 +8265,7 @@ pub struct HirInstance { } #[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] pub enum HwMemKind { Bram, Dram, @@ -8429,6 +8445,7 @@ impl HirClockDomain { } #[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] pub enum HwCrossStrategy { TwoFlop, FifoAsync, @@ -8444,6 +8461,7 @@ pub struct HirClockCrossing { } #[derive(Debug, Clone, PartialEq)] +#[allow(dead_code)] pub enum HwFifoKind { Sync, Async, diff --git a/docs/NOW.md b/docs/NOW.md index f9a832a58..33a92cb08 100644 --- a/docs/NOW.md +++ b/docs/NOW.md @@ -2,6 +2,13 @@ Last updated: 2026-06-14 +## loop9-s-hir-deadcode-slice -- per-enum allow(dead_code) for HIR/FPGA grammar enums (Closes #1129) + +- **WHERE**: bootstrap/src/compiler.rs (HIR/FPGA grammar enums), scripts/warnings-baseline.sh. +- **WHAT**: added a scoped #[allow(dead_code)] to 8 spec-complete HIR/FPGA grammar enums (HwType, HwResetKind, HwResetPolarity, HwEdge, HirAlwaysStmtKind, HwMemKind, HwCrossStrategy, HwFifoKind) and lowered the warnings baseline 655 -> 647. +- **Why** a targeted #969 slice: these variants are an intentionally spec-complete AST surface, not accidental dead code; per-enum suppression (not file-level) keeps it reviewable, same pattern as #1111/#1122. L6 gf16 SSOT untouched; catalog stays 83; no gen/ edits; ASCII-only added lines; no quality claim added. Closes #1129. +- **Anchor**: phi^2 + phi^-2 = 3 + ## make-verify-umbrella -- single advisory pre-PR umbrella (make verify) (Closes #1124) - **WHERE**: new `scripts/verify.sh` and the top-level `Makefile` (new `verify` target + `make help` entry). diff --git a/scripts/warnings-baseline.sh b/scripts/warnings-baseline.sh index 54fee841b..6384954d7 100755 --- a/scripts/warnings-baseline.sh +++ b/scripts/warnings-baseline.sh @@ -30,11 +30,11 @@ set -uo pipefail # (in the same PR) whenever a reviewed slice legitimately lowers it, so the # meter keeps tracking real progress. Measured precisely from the structured # JSON diagnostics on master. History: 683 after the host/mod.rs facade slice -# (#1111); 655 after the host/errors.rs catalog slice (variant P, issue #1122) -# annotated its 28 dead_code symbols. (Earlier NOW.md entries quoted ~685/726 -# from the cargo summary line, which rounds differently; this script's -# primary-span count is the canonical meter.) -BASELINE=655 +# (#1111); 655 after the host/errors.rs catalog slice (variant P, issue #1122); +# 647 after the HIR/FPGA grammar-enum slice (variant S). (Earlier NOW.md entries +# quoted ~685/726 from the cargo summary line, which rounds differently; this +# script's primary-span count is the canonical meter.) +BASELINE=647 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"