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
42
43
44
45
46
47
48
49
50
51
//! Trybuild compile-fail harness for Hopper's macro-level safety proofs.
//!
//! Each fixture in `tests/compile_fail/` is a crate input that *must not*
//! compile. The matching `.stderr` snapshot captures the exact compiler
//! error we want to surface. When a refactor changes an error message,
//! run `TRYBUILD=overwrite cargo test --test ui` to regenerate snapshots,
//! then eyeball the diff. if the new message still proves the same
//! safety property, accept it; otherwise investigate.
//!
//! This harness mechanically enforces the Hopper Safety Audit's
//! "Compile-fail coverage" item. The five shipping cases cover
//! `#[hopper::pod]`:
//!
//! | Fixture | Violation |
//! |---|---|
//! | `pod_bool_field.rs` | `bool` field (not all bit patterns valid) |
//! | `pod_char_field.rs` | `char` field (sparse valid code points) |
//! | `pod_reference_field.rs` | `&'static u8` field (pointers are not Pod) |
//! | `pod_missing_repr.rs` | no `#[repr(C)]` / `#[repr(transparent)]` |
//! | `pod_padded_u64.rs` | implicit padding between `u8` and `u64` |
//! | `pod_vec_field.rs` | heap `Vec<u8>` field in a Pod layout |
//! | `zerocopy_seal_required.rs` | bypass `#[hopper::pod]` and hand-roll `Pod`: cannot earn `ZeroCopy` |
//! | `ref_only_rejects_raw_ref.rs` | naked `&mut T` cannot satisfy `HopperRefOnly` (audit Finding 2) |
//!
//! Additional `state_*` fixtures are added in Stage 2 as each
//! `#[account(...)]` constraint attribute lands.