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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! Central home for every numeric limit / bound used across the analysis and
//! verification pipeline.
//!
//! Before this module, each limit lived as a module-local `const`/`static` next
//! to its consumer, so thresholds were duplicated (the `16`-block inline cap
//! appeared in both the path graph and the runtime inliner) and hard to audit.
//! Keeping them all here mirrors [`crate::def_id`]: one flat, well-documented
//! location where a knob can be found and tuned without grepping the crate.
//!
//! Everything is `pub(crate)`; names that would otherwise collide across
//! modules (the two `VISIT_LIMIT`s, the two `MAX_DEPTH`s) are prefixed with
//! their owning analysis.
// ─────────────────────────────────────────────────────────────────────────────
// Path enumeration
// ─────────────────────────────────────────────────────────────────────────────
use ;
/// Maximum number of paths collected per search — both whole-CFG enumeration
/// and per-checkpoint prefix collection. Overridable via the `--path-limit`
/// CLI flag.
pub const PATH_LIMIT: usize = 512;
/// Runtime override for [`PATH_LIMIT`], set from `--path-limit`. `0` means
/// "not overridden" (the default above applies).
static PATH_LIMIT_OVERRIDE: AtomicUsize = new;
/// Set the `--path-limit` override; `0` restores [`PATH_LIMIT`].
pub
/// The effective path cap (override, or [`PATH_LIMIT`]).
pub
/// Maximum DFS depth for whole-CFG path enumeration.
pub const WHOLE_CFG_PATH_DEPTH_LIMIT: usize = 256;
/// Bounded cache size for SCC path enumeration.
pub const SCC_PATH_CACHE_LIMIT: usize = 2048;
/// Maximum DFS depth for intra-SCC path enumeration.
pub const SCC_MAX_DEPTH: usize = 128;
/// Maximum number of distinct paths collected per SCC.
pub const SCC_MAX_SEEN_PATHS: usize = 128;
/// Maximum path length within an SCC traversal.
pub const SCC_MAX_PATH_LEN: usize = 200;
// ─────────────────────────────────────────────────────────────────────────────
// Inlining
// ─────────────────────────────────────────────────────────────────────────────
/// A local callee is inlined into the path CFG only when its MIR is at most
/// this many basic blocks. This is a *transitive* shape bound: local inlining
/// recurses into the callee's own calls, so every inlined body multiplies the
/// path-graph size. Cross-crate callees are exempt — they are inlined a single
/// level and never recursed into, so their size is not bounded here.
pub const LOCAL_INLINE_BLOCK_LIMIT: usize = 32;
/// Recursion depth bound for runtime inlining
/// ([`crate::verify::vm::call::exec_inline_call`]). Recursive inlining unwinds
/// through the Rust call stack, so this caps nesting.
pub const MAX_INLINE_DEPTH: usize = 5;
// ─────────────────────────────────────────────────────────────────────────────
// Loop sensitivity / postfix repeat
// ─────────────────────────────────────────────────────────────────────────────
/// Caps how many times a loop body is unrolled during path enumeration;
/// loop-heavy functions (e.g. UTF-16 decoders) scale super-linearly with it.
/// Lower it to speed up verification at the cost of loop sensitivity (bugs that
/// only manifest after more iterations can be missed).
pub const MAX_AUTO_REPEAT: usize = 8;
/// Fallback loop-carried distance used when a sink is loop-sensitive but the
/// local transfer graph is too imprecise to calculate a better distance.
///
/// Three backedges calibrates to `allow_repeat = 2`, which is the first depth
/// needed by the delayed pointer/state cases in `loop_repeat_threshold`.
pub const DEFAULT_LOOP_CARRIED_BACKEDGES: usize = 3;
/// Conservative first numeric witness when an index obligation is known to be
/// induction-sensitive but the current summary cannot yet recover a concrete
/// symbolic bound.
pub const DEFAULT_NUMERIC_WITNESS_ITERATION: usize = 4;
/// The first repeat depth that reliably exposes the existing delayed
/// loop-carried pointer/state fixtures.
pub const MIN_DATAFLOW_REPEAT: usize = 2;
// ─────────────────────────────────────────────────────────────────────────────
// Points-to / alias
// ─────────────────────────────────────────────────────────────────────────────
/// Hard cap on the number of values a single points-to path may materialize.
pub const MAX_VALUES_PER_PATH: usize = 1000;
/// Recursion cap on nested field projection while building a points-to graph.
pub const MAX_FIELD_DEPTH: usize = 5;
/// Recursion cap on nested dereferences while building a points-to graph.
pub const MAX_DEREF_DEPTH: usize = 3;
/// Visit cap for the alias-graph DFS/iteration in the default alias analysis.
pub const ALIAS_VISIT_LIMIT: usize = 80;
// ─────────────────────────────────────────────────────────────────────────────
// SafeDrop
// ─────────────────────────────────────────────────────────────────────────────
/// Visit cap for the SafeDrop graph DFS.
pub const SAFEDROP_VISIT_LIMIT: usize = 1000;
// ─────────────────────────────────────────────────────────────────────────────
// Call-summary recognition (interprocedural)
// ─────────────────────────────────────────────────────────────────────────────
/// Max basic-block count for a local callee to be recognized as a
/// pointer-arithmetic (add/sub) wrapper summary.
pub const POINTER_ARITH_WRAPPER_BLOCK_LIMIT: usize = 16;
/// Max basic-block count for a local callee to be recognized as a
/// `from_raw_parts` wrapper summary.
pub const FROM_RAW_PARTS_WRAPPER_BLOCK_LIMIT: usize = 8;
/// Max basic-block count for a local callee to be recognized as a pure
/// field-load (`_0 = (*_1).field`) summary.
pub const FIELD_LOAD_EFFECT_BLOCK_LIMIT: usize = 4;
/// Max basic-block count for a local callee to be recognized as a
/// slice-bounded return summary.
pub const SLICE_BOUNDED_RETURN_BLOCK_LIMIT: usize = 12;
// ─────────────────────────────────────────────────────────────────────────────
// API dependency
// ─────────────────────────────────────────────────────────────────────────────
/// Upper bound on type complexity accepted when resolving API-dependency
/// output types.
pub const MAX_TY_COMPLX: usize = 5;
/// Cap on the number of monomorphization steps retained per API-dependency
/// resolution.
pub const MAX_STEP_SET_SIZE: usize = 1000;
/// Recursion depth cap for the fuzzable-type predicate.
pub const FUZZABLE_MAX_DEPTH: usize = 64;