pub enum ReasonClass {
Reflect,
Dispatch,
Indirect,
Native,
Unresolved,
Setup,
}Expand description
The NORMATIVE projection of a raw unknown_why reason onto a fixed, cross-engine reason CLASS
(candor-spec REASON-SCOPED-UNKNOWN-DESIGN.md §1). Reason-scoped policies (deny E Unknown[class])
quantify over these classes, so the mapping MUST be identical in every engine — this mirrors the
java reference ReasonClass (its classify(String) path, since rust emits raw string reasons). The
class set is CLOSED (six members); a raw reason matching no pinned prefix maps to Unresolved —
conservative: it stays in scope of any Unknown[*] / Unknown[dynamic] policy, never silently
tolerated.
Variants§
Reflect
reflection / metaprogramming
Dispatch
unresolved virtual/dynamic dispatch, same-name ambiguity, invokedynamic
Indirect
callback / closure / function-value / async-continuation indirection
Native
FFI / native boundary
Unresolved
generic unresolvable call/import, AND the catch-all for any unrecognized raw reason
Setup
analysis not wired up (fixable, not a real dynamic hole): missing-config / no-tsconfig
Implementations§
Source§impl ReasonClass
impl ReasonClass
Sourcepub fn token(self) -> &'static str
pub fn token(self) -> &'static str
The lowercase policy-facing token (deny E Unknown[<token>]).
Sourcepub fn from_token(t: &str) -> Option<ReasonClass>
pub fn from_token(t: &str) -> Option<ReasonClass>
Parse a policy-facing token back to a class; None if it names no class.
Sourcepub fn classify(why: &str) -> ReasonClass
pub fn classify(why: &str) -> ReasonClass
Map a raw unknown_why reason to its normative class — prefix-based (raw reasons carry a
kind:detail shape, e.g. dispatch:foo::Bar), unrecognized → Unresolved. Byte-identical
intent to the java ReasonClass.classify(String).
⟨0.24⟩ THIS IS THE ONLY PLACE THIS ENGINE HOLDS SPEC §4’s KIND VOCABULARY. Every other reference
to a kind is either a raw string being emitted or the dispatch: prefix test in candor-query’s
dispatch frontier; there is no typed kind enum here. §4’s “AN ENGINE HOLDS THIS VOCABULARY TWICE,
AND THE HALVES DRIFT” paragraph records the JVM engine classifying ambiguous correctly HERE
while its typed Kind enum lacked the kind entirely — one token, two answers, inside one engine,
concealed precisely because this half was right. Holding it once is why that is not reachable in
this engine; a future typed representation must be added at the same commit as its control
(off_vocabulary_kinds_round_trip_and_classify_through_the_catch_all).
The five §4 kinds are reflect/native/dispatch/callback/ambiguous. ambiguous maps to
dispatch and rust is its only PRODUCER; indy/task-handoff are candor-java’s migration kinds
and dep:/dep-stale: are swift’s registered per-dependency-ENTRY kinds, reaching Unresolved
through the catch-all, which is the class §6.2 prescribes for them.
⟨0.35⟩ AND THIS ENGINE PRODUCES A SIXTH SPELLING OF ITS OWN, macro:, WHICH THE PARAGRAPH
ABOVE DID NOT NAME UNTIL SOUNDNESS R270. It is off-vocabulary as a §4 kind — legal under §2
forward-compatibility, round-tripped verbatim, and reaching Unresolved through the catch-all
below, deliberately: it marks the ZERO-READABLE-DEFS case (a macro this engine declined to
expand), which is “a limit of its own resolution rather than an ambiguity in the program” in
§4 ⟨0.25⟩’s words, and dispatch is the wrong class for that. Four sites emit it, and they are
listed here rather than left to a grep because the whole hazard this doc comment exists for is a
vocabulary held in one place going stale while the code moves:
collector.rsmacro:unexpanded multi-arm macro_rules! <name>(R257)collector.rsmacro:unreadable macro_rules! template <name>(R257)collector.rsmacro:re-export key a macro-hidden module could also own(R270)scan.rsmacro:module items hidden by an unexpanded macro(R270, R128’s site)
R257 minted the spelling at exactly the two lines it was reported for and this comment kept
asserting the file held the vocabulary once; R270 is the sweep, and the census that justified it
enumerates every ambiguous:-emitting site rather than the ones in hand. The six that REMAIN
ambiguous: are each genuinely two-separately-written-definitions — including
ambiguous:same-name macro_rules! definitions, which a sweep keyed on the WORD “macro” would
have re-kinded wrongly and cost 15 crates their deny Unknown[dispatch] gate. The kind is
decided by the CONDITION (two readable defs vs none), never by the name.
A dedicated §4 kind for this state is a SPEC clause plus a conformance PART before any engine emits it, and candor-rust does not own that file — filed, not invented here.
Sourcepub fn dynamic_set() -> BTreeSet<ReasonClass>
pub fn dynamic_set() -> BTreeSet<ReasonClass>
The dynamic alias — every GENUINE blind-spot class (excludes setup), incl. unresolved (the
catch-all) so Unknown[dynamic] never under-gates. The design’s recommended usable strict gate.
Trait Implementations§
Source§impl Clone for ReasonClass
impl Clone for ReasonClass
Source§fn clone(&self) -> ReasonClass
fn clone(&self) -> ReasonClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more