Skip to main content

ReasonClass

Enum ReasonClass 

Source
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

Source

pub fn token(self) -> &'static str

The lowercase policy-facing token (deny E Unknown[<token>]).

Source

pub fn from_token(t: &str) -> Option<ReasonClass>

Parse a policy-facing token back to a class; None if it names no class.

Source

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.rs macro:unexpanded multi-arm macro_rules! <name> (R257)
  • collector.rs macro:unreadable macro_rules! template <name> (R257)
  • collector.rs macro:re-export key a macro-hidden module could also own (R270)
  • scan.rs macro: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.

Source

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

Source§

fn clone(&self) -> ReasonClass

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ReasonClass

Source§

impl Debug for ReasonClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ReasonClass

Source§

impl Hash for ReasonClass

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ReasonClass

Source§

fn cmp(&self, other: &ReasonClass) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for ReasonClass

Source§

fn eq(&self, other: &ReasonClass) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for ReasonClass

Source§

fn partial_cmp(&self, other: &ReasonClass) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for ReasonClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.