Skip to content

feature - layout repr and calling-convention metadata v0 #688

@dannymeijer

Description

@dannymeijer

Area

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)
  • Tooling (CLI/formatter/test runner)
  • Runtime / Core crates (stdlib/core/derive)

Problem statement

Freestanding targets, ABI-visible exports, Rust-facing packages, C/extern boundaries, boot protocols, and memory-mapped structures need explicit representation facts. Ordinary Incan types can remain layout-opaque, but low-level and boundary-facing code needs a way to say which layout, alignment, representation, and calling-convention facts are intentional.

The design work belongs to #683, but 0.8 also needs an implementation tracker for the first metadata and lowering slice after the RFC direction is accepted.

Proposed solution

Implement experimental layout/repr/calling-convention metadata v0 for ABI-visible declarations once the RFC direction is clear.

The first implementation should focus on metadata flow and validation before promising a stable public ABI:

  • parser/metadata support for accepted representation and calling-convention declarations;
  • typechecker validation for allowed declaration targets and invalid combinations;
  • IncanType and ABI metadata facts for explicit representation choices;
  • HIR/Body IR preservation of ABI-visible type/function properties;
  • build report and semantic inspection output for representation facts;
  • backend lowering for the minimum supported representation profiles.

Alternatives considered

  • Keep layout entirely backend-owned. Rejected because ABI-facing and freestanding code needs intentional representation contracts.
  • Make every model layout-stable. Rejected because it would freeze high-level application types too early.
  • Treat Rust spelling as the contract. Rejected because Incan needs an Incan-owned ABI metadata model even when a Rust-compatible backend is used.

Scope / acceptance criteria

  • In scope:
  • Out of scope:
  • Done when:
    • Explicit representation/calling-convention declarations survive parsing, checking, HIR/Body IR, ABI metadata, and inspection.
    • Unsupported or target-invalid representation choices produce diagnostics.
    • The minimum representation facts needed for freestanding smoke and 0.9 kernel proof planning are available or explicitly listed as blockers.
    • Ordinary types remain layout-opaque unless they opt into an explicit representation profile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestincan compilerSuggestions, features, or bugs related to the Compiler (frontend/backend/codegen)incan language semanticsSuggestions, features, or bugs related to the Incan Language itself (syntax and semantics)runtime / core cratesSuggestions, features, or bugs related to the `incan-core`, `incan-stdlib`, 'incan-derive` cratestoolingSuggestions, features, or bugs related to the Tooling (CLI/formatter/test runner)
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions