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
//! Open `GateContract` inventory consumed by
//! [`crate::validate_runtime_complete`].
//!
//! Each gate-insertion pass declares a `GateContract` impl + emits
//! `inventory::submit! { GateContractRegistration { ... } }`; the
//! validator iterates the inventory and runs every registered
//! contract's `assert_inserted` against the post-insertion graph.
//! Adding a new gate is "ship the inserting pass + register its
//! contract" — no edit to the validator.
use GraphProto;
use inventory;
use crateCompileError;
/// A single insertion contract a gate-inserting pass owns.
///
/// `assert_inserted` runs on every per-role sub-graph after the
/// gate-insertion phase; it returns `Ok(())` when the gate this
/// contract represents is consistent with the graph the validator
/// observes (either absent because nothing needs it, OR present in
/// the canonical insertion shape).
/// Inventory-collected pointer to a `GateContract` implementation
/// shipped by a gate-insertion pass. Library makers introducing a
/// new gate emit one inventory submission alongside their pass.
collect!;
/// Iterate every `GateContract` the binary links in.