Skip to main content

lower_type_shape_ir

Function lower_type_shape_ir 

Source
pub fn lower_type_shape_ir(
    decl: &Arc<TypeDecl>,
    program: &CheckedProgram,
) -> TypeShape
Expand description

A type declaration’s resolved structure as a TypeShape — the reader emitter.rs’s own type_shape_for calls directly. (Slice 1 of #1542 split this out of a full IrItem::Type constructor whose single field it was, ending a build-then-unreachable!-discard round-trip; Slice D1 then deleted that constructor, leaving this as the type reader.)

Takes a certified &CheckedProgram, matching this module’s own categorical discipline (this file’s own header doc: “every entry point here takes a &CheckedProgram”), even though only TypedCommons::types/ty_intern are read — no per-expression expr_types lookup is involved (Q2, design/tracks/the-ir.md §3.2), but which fields are read isn’t the discipline; which failures are allowed to panic! is. Every panic below asserts “the checker already accepted this declaration” — true only once certify has run: a bare TypedCommons is not certified by construction (checker.rs’s own CheckedProgram doc notes the project/batch path holds per-unit TypedCommons values before that unit’s build-wide gate is decided), so accepting one here would make resolve_type_ref_in returning None a reachable, not just a buggy, outcome.