GatherOutput

Struct GatherOutput 

Source
pub struct GatherOutput<'a> {
Show 14 fields pub rir: &'a Rir, pub interner: &'a ThreadedRodeo, pub structs: HashMap<Spur, StructId>, pub enums: HashMap<Spur, EnumId>, pub functions: HashMap<Spur, FunctionInfo>, pub methods: HashMap<(StructId, Spur), MethodInfo>, pub constants: HashMap<Spur, ConstInfo>, pub preview_features: PreviewFeatures, pub builtin_string_id: Option<StructId>, pub builtin_arch_id: Option<EnumId>, pub builtin_os_id: Option<EnumId>, pub builtin_typekind_id: Option<EnumId>, pub type_pool: TypeInternPool, pub param_arena: ParamArena,
}
Expand description

Output from the declaration gathering phase.

This contains the state built during declaration gathering that is needed for function body analysis. After gathering, this can be converted back into a Sema for sequential analysis, or used to drive parallel analysis.

§Architecture

The separation of declaration gathering from body analysis enables:

  1. Parallel type checking - Each function can be analyzed independently
  2. Clearer architecture - Separation of concerns
  3. Foundation for incremental - Can cache SemaContext across compilations
  4. Better error recovery - One function’s error doesn’t block others

§Usage

// Option A: Simple path - all-in-one analysis
let sema = Sema::new(rir, interner, preview);
let output = sema.analyze_all()?;

// Option B: Parallel path (work in progress)
// Build SemaContext and analyze in parallel
let ctx = sema.build_sema_context();
let results: Vec<_> = functions.par_iter()
    .map(|f| analyze_function_body(&ctx, f))
    .collect();

Fields§

§rir: &'a Rir

Reference to the RIR being analyzed.

§interner: &'a ThreadedRodeo

Reference to the string interner.

§structs: HashMap<Spur, StructId>

Struct lookup: maps struct name symbol to StructId.

§enums: HashMap<Spur, EnumId>

Enum lookup: maps enum name symbol to EnumId.

§functions: HashMap<Spur, FunctionInfo>

Function lookup: maps function name to info.

§methods: HashMap<(StructId, Spur), MethodInfo>

Method lookup: maps (struct_id, method_name) to info.

§constants: HashMap<Spur, ConstInfo>

Constant lookup: maps const name to info.

§preview_features: PreviewFeatures

Enabled preview features.

§builtin_string_id: Option<StructId>

StructId of the synthetic String type.

§builtin_arch_id: Option<EnumId>

EnumId of the synthetic Arch enum (for @target_arch intrinsic).

§builtin_os_id: Option<EnumId>

EnumId of the synthetic Os enum (for @target_os intrinsic).

§builtin_typekind_id: Option<EnumId>

EnumId of the synthetic TypeKind enum (for @typeInfo intrinsic).

§type_pool: TypeInternPool

Type intern pool (ADR-0024 Phase 1).

§param_arena: ParamArena

Arena storage for function/method parameter data.

Implementations§

Source§

impl<'a> GatherOutput<'a>

Source

pub fn into_sema(self) -> Sema<'a>

Convert this gather output back into a Sema for function body analysis.

This is used for sequential analysis. The returned Sema has all declarations already collected and is ready to analyze function bodies.

Trait Implementations§

Source§

impl<'a> Debug for GatherOutput<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for GatherOutput<'a>

§

impl<'a> !RefUnwindSafe for GatherOutput<'a>

§

impl<'a> Send for GatherOutput<'a>

§

impl<'a> Sync for GatherOutput<'a>

§

impl<'a> Unpin for GatherOutput<'a>

§

impl<'a> !UnwindSafe for GatherOutput<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more