Skip to main content

ProgramShape

Struct ProgramShape 

Source
pub struct ProgramShape {
    pub per_fn: HashMap<FnId, FnRecognition>,
    pub sccs: HashSet<FnId>,
    pub patterns: Vec<ModulePattern>,
    pub inductable_sum_types: HashSet<String>,
}
Expand description

Whole-program shape facts produced by analyze_program.

Stage 4 of issue #232 (0.23 “Shape”). This is the recognition substrate every downstream consumer reads from — aver shape CLI, proof_lower’s strategy router, future inliner / monomorphizer. Stage 6 will grow patterns: Vec<ModulePattern> and relations: Vec<FnRelation> next to per_fn for the higher-arity recognitions (WrapperOverRecursion, RefinementSmartConstructor, ResultPipelineChain, …).

Computed once per compilation per the peer-review note (“compute ProgramShape once per compilation / per HIR snapshot — don’t persistent-cache per FnId yet”). Threaded as a read-only borrow from the call site; the analysis tier never mutates it.

Fields§

§per_fn: HashMap<FnId, FnRecognition>

Per-fn recognition keyed by stable FnId.

§sccs: HashSet<FnId>

Multi-node SCC participants in the local call graph. Kept here so consumers don’t have to recompute Tarjan to ask “is this fn part of a mutual-recursion group?”.

§patterns: Vec<ModulePattern>

Whole-module typed patterns (stage 6 of #232). Populated by analyze_program_with_modules; analyze_program leaves this empty since it only sees the resolved-fn snapshot, not the source items needed to detect module-level shapes like RefinementSmartConstructor.

§inductable_sum_types: HashSet<String>

Source-level sum type names that are eligible as induction targets: directly self-referential in at least one variant and not indirectly recursive through nested generics the per-variant emit can’t case-split (e.g. Some(List<Self>)). Mirrors proof_lower::detect_induction_target’s inline scan so the detector can read this set instead of re-walking type defs.

Implementations§

Source§

impl ProgramShape

Source

pub fn for_fn(&self, fn_id: FnId) -> Option<&FnRecognition>

Recognition for one fn by id. Returns None for fns that weren’t included in the call to analyze_program (e.g. an out-of-tree id or a stale lookup against a refreshed view).

Trait Implementations§

Source§

impl Clone for ProgramShape

Source§

fn clone(&self) -> ProgramShape

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 Debug for ProgramShape

Source§

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

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

impl Default for ProgramShape

Source§

fn default() -> ProgramShape

Returns the “default value” for a type. Read more

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V