Skip to content

Add the comline-catalog Rust crate - #2

Merged
Kinflou merged 2 commits into
mainfrom
rust-crate
Nov 9, 2026
Merged

Kinflou merged 2 commits into
mainfrom
rust-crate

Conversation

@Kinflou

@Kinflou Kinflou commented Nov 9, 2026

Copy link
Copy Markdown
Member

The first step of core reading the catalog (ComlineProject/core#219 rollout, stage 2): the catalog as a Rust crate that core, and later the runtime and the language server, depend on by git rev.

  • rust/, comline-catalog:
    • It is no_std, has no dependencies, and supports Rust 1.82 (core's MSRV). It builds for wasm32, so core's IR-only build can use it.
    • The types (Guarantee, Fact, Value, Encoding, Feature, Kind, Origin, Status) and the lookups (guarantee, fact, facts_of, encoding, resolve for a wire name or an alias, feature) are hand-written in lib.rs.
    • The data is generated in src/catalog.rs: the GUARANTEES, FACTS, ENCODINGS and FEATURES tables in catalog order, id constants (encoding::PACKED_1, guarantee::BOUNDED_SIZE, and so on), every set with ALIASES, and SPEC_VERSION from VERSION.
  • catalog/rust.cue generates the data with plain CUE string interpolation, so no other toolchain is needed. Template maps would sort the keys, and the order matters. Strings are raw literals, and the catalog refuses any text containing "#. Constant names must be unique within each kind.
  • specs/check.sh writes rust/src/catalog.rs, and with --check fails when it is stale. It passes VERSION in as a CUE tag.
  • CI gets a new rust crate job: tests and clippy (-D warnings) on stable, check on 1.82.0, and a wasm32 build.

Tested locally: check.sh --check, cargo test (5 tests), clippy clean, cargo +1.82.0 check, and a wasm32 build.

Next: core depends on it and reads guarantees, facts, aliases and frozen spellings from it, with tests that its hand-written Guarantee matches the catalog exactly.

Kinflou added 2 commits November 9, 2026 22:29
rust/ is a no_std, dependency-free crate holding the catalog as Rust
constants and tables: guarantees, facts with their values, the official
encodings with aliases and frozen spellings, features, sets and
SPEC_VERSION. Its types and lookups are hand-written; its data,
rust/src/catalog.rs, is generated from the CUE (catalog/rust.cue) by
specs/check.sh, which fails on a stale copy. CI tests it on stable, checks
it on Rust 1.82 and builds it for wasm32.
@Kinflou
Kinflou merged commit 69d8832 into main Nov 9, 2026
2 checks passed
@Kinflou
Kinflou deleted the rust-crate branch November 9, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant