1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Computes a fingerprint of the compiler front-end at build time so the
//! bytecode cache key tracks the *compiler's behavior*, not just the released
//! version.
//!
//! `harn run` caches compiled bytecode on disk keyed by source content and the
//! crate version. Within a single version the compiler still changes constantly
//! during development, so an entry produced by an older compiler would be
//! replayed silently — masking the new compiler's output. This is exactly what
//! hid the #2610 fix until `~/.cache/harn/bytecode` was manually cleared, and
//! is tracked as #2621.
//!
//! We close that gap by hashing the source of every crate that determines the
//! bytecode emitted for a given program — the lexer, parser, and IR
//! (source → typed AST) plus this crate's code generator and bytecode/`Chunk`
//! types — and baking the digest into the binary as `HARN_CODEGEN_FINGERPRINT`.
//! The `cargo:rerun-if-changed` lines recompute it whenever any of those files
//! change, so the cache invalidates itself with no manual wipe and no
//! hand-maintained version constant. Over-inclusion only costs an occasional
//! recompile; omitting a code-generation input would reintroduce the bug, so
//! the set is deliberately drawn wide around the front-end.
use PathBuf;