Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
# reports its own context failed or cancelled, which fails the group.
build:
name: Queue build
uses: moq-dev/rust2/.github/workflows/queue-build.yml@main
uses: kixel-ai/rust2/.github/workflows/queue-build.yml@main

# The merge queue still builds every group with the jobs above; this only
# satisfies the PR-side requirement, as a pull_request run's skipped job does.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Rust to other places.

- **TypeScript**: an own rustc driver that translates a [documented Rust subset](ts/README.md) to TypeScript, without WASM.
- **C, then any language**: an [exporter](ffi/README.md) that turns a crate's `pub` API into a C ABI and header with no attributes, sharing the TypeScript driver's front end.
- **Faster builds**: a reproducible [build-speed benchmark](bench/build/README.md) of upstream's levers on moq, and [rust2-lint](driver/src/bin/rust2-lint/main.rs), which fails a build whose generics' copies cost its codegen more than a budget (`nix run github:moq-dev/rust2#lint -- --help`).
- **Faster builds**: a reproducible [build-speed benchmark](bench/build/README.md) of upstream's levers on moq, and [rust2-lint](driver/src/bin/rust2-lint/main.rs), which fails a build whose generics' copies cost its codegen more than a budget (`nix run github:kixel-ai/rust2#lint -- --help`).

Everything here is early; the [quest tree](quest/README.md) holds the plan.

Expand Down
6 changes: 3 additions & 3 deletions bench/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The body edits are functions the program runs, which ra-jit compiles.

ra-jit bugs seen on moq, not reported upstream:

- Async body edits in moq-net go to cargo (every `edit-async` run): "`parsed_values_given` is not compiled by ra-jit and rustc's copy is from before the edit: an instance of it does not compile", a generic of usage-argv's. The daemon then loads the workspace again: on CI such an edit took 50.6 s and 196 CPU-s, against plain cargo's 10.5 s and 14.5 CPU-s ([run](https://github.com/moq-dev/rust2/actions/runs/42351623273)).
- Async body edits in moq-net go to cargo (every `edit-async` run): "`parsed_values_given` is not compiled by ra-jit and rustc's copy is from before the edit: an instance of it does not compile", a generic of usage-argv's. The daemon then loads the workspace again: on CI such an edit took 50.6 s and 196 CPU-s, against plain cargo's 10.5 s and 14.5 CPU-s ([run](https://github.com/kixel-ai/rust2/actions/runs/42351623273)).
- At the previous pin (`f36c848`), `cargo ra-jit check` with no build loaded read every crate of the workspace, took minutes and GBs, and failed on errors rustc does not report (`unresolved macro moq_clock::test` in moq-net's integration tests).
- On a library-only build, `cargo ra-jit build` returns after `cargo clean` without building anything.

Expand Down Expand Up @@ -102,7 +102,7 @@ Measured on 2026-10-25 and 2026-10-26 on a busy 32-CPU host, in billions of inst
## Cranelift for moq's CI

Recommended on 2026-10-25: moq's CI keeps building its tests with LLVM, since 42 of its 5418 tests fail under Cranelift.
At the pin [#646](https://github.com/moq-dev/rust2/pull/646) moved to on 2026-11-07, 58 of 6379 fail: 27 that catch a panic and 31 on the intrinsic ([rustc_codegen_cranelift#1712](https://github.com/rust-lang/rustc_codegen_cranelift/issues/1712)). The numbers below are the 2026-10-25 run's. No retrial is planned once upstream fixes both: the saving below is the ceiling, and unwinding can only lower it.
At the pin [#646](https://github.com/kixel-ai/rust2/pull/646) moved to on 2026-11-07, 58 of 6379 fail: 27 that catch a panic and 31 on the intrinsic ([rustc_codegen_cranelift#1712](https://github.com/rust-lang/rustc_codegen_cranelift/issues/1712)). The numbers below are the 2026-10-25 run's. No retrial is planned once upstream fixes both: the saving below is the ceiling, and unwinding can only lower it.

- 23 catch a panic, which the Cranelift backend that ships with nightly cannot unwind: it builds every panic as an abort (unwinding is a flag on cg_clif's own build, off by default: [rustc_codegen_cranelift#1567](https://github.com/rust-lang/rustc_codegen_cranelift/issues/1567)).
- 19 abort on an x86 SIMD intrinsic it does not implement, `llvm.x86.sse2.pmulhu.w` ([rustc_codegen_cranelift#1712](https://github.com/rust-lang/rustc_codegen_cranelift/issues/1712), under the SIMD tracker [#171](https://github.com/rust-lang/rustc_codegen_cranelift/issues/171)). moq's CI runs on aarch64, whose intrinsics this x86 benchmark does not try.
Expand All @@ -111,7 +111,7 @@ The `cranelift` variant's `build` numbers are for that abort build too.
Since moq moved its crypto onto rind, the variant builds rind with LLVM: its `naked_asm!` takes `sym` operands, which Cranelift cannot compile yet ([rustc_codegen_cranelift#1620](https://github.com/rust-lang/rustc_codegen_cranelift/pull/1620)).

Even passing, it would save little where CI spends its time.
CPU seconds from the [PR run](https://github.com/moq-dev/rust2/actions/runs/40235946635) (4 CPUs; an A/A control on that run stayed within 3%):
CPU seconds from the [PR run](https://github.com/kixel-ai/rust2/actions/runs/40235946635) (4 CPUs; an A/A control on that run stayed within 3%):

| CI build | nightly | cranelift | change |
| --- | ---: | ---: | ---: |
Expand Down
2 changes: 1 addition & 1 deletion driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "The rustc driver front end that rust2's drivers share, and rust2-
version = "0.0.0"
edition = "2024"
license = "MIT OR Apache-2.0"
repository = "https://github.com/moq-dev/rust2"
repository = "https://github.com/kixel-ai/rust2"
# A path dependency of the drivers, and rust2-lint through the flake: it only builds on
# their pinned nightly.
publish = false
Expand Down
2 changes: 1 addition & 1 deletion driver/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_driver::Callbacks;
use rustc_session::EarlyDiagCtxt;
use rustc_session::config::ErrorOutputType;

const BUG_REPORT_URL: &str = "https://github.com/moq-dev/rust2/issues/new";
const BUG_REPORT_URL: &str = "https://github.com/kixel-ai/rust2/issues/new";

/// Whether cargo ran this binary as its wrapper, which it does with the rustc it would
/// have run as the first argument.
Expand Down
2 changes: 1 addition & 1 deletion ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Export a crate's pub API as a C ABI and header"
version = "0.0.0"
edition = "2024"
license = "MIT OR Apache-2.0"
repository = "https://github.com/moq-dev/rust2"
repository = "https://github.com/kixel-ai/rust2"
# Distributed through the flake: it only builds on the pinned nightly.
publish = false

Expand Down
2 changes: 1 addition & 1 deletion go/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Translate a Rust subset to pure Go"
version = "0.0.0"
edition = "2024"
license = "MIT OR Apache-2.0"
repository = "https://github.com/moq-dev/rust2"
repository = "https://github.com/kixel-ai/rust2"
# Distributed through the flake: it only builds on the pinned nightly.
publish = false

Expand Down
14 changes: 7 additions & 7 deletions quest/m0/nightly-red.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

The nightly passes on `main`: its "Export moq-net to C" and "Export to Kotlin on Android"
jobs, which failed in
[run 43246857664](https://github.com/moq-dev/rust2/actions/runs/43246857664) at `53d822ed`
[run 43246857664](https://github.com/kixel-ai/rust2/actions/runs/43246857664) at `53d822ed`
on 2026-11-12, after
[run 43038758163](https://github.com/moq-dev/rust2/actions/runs/43038758163) passed at
[run 43038758163](https://github.com/kixel-ai/rust2/actions/runs/43038758163) passed at
`936ce441` the day before.

## Plan
Expand All @@ -17,17 +17,17 @@ Reproduce each before fixing it, at its root.
- "Export moq-net to C" fails compiling `ffi/moq/moq.swift` under warnings as errors:
the `Task(executorPreference: self, operation: body)` in `launch` is an unstructured
throwing task whose result is unused. The job runs on arm64 Linux, where
[#711](https://github.com/moq-dev/rust2/pull/711) first ran the Swift, so name #711
[#711](https://github.com/kixel-ai/rust2/pull/711) first ran the Swift, so name #711
under `## Caused by`.
- "Export to Kotlin on Android" fails `api_android` at `ffi/tests/api.kt`'s `budgeted`:
"the GC frees bytes lent once the budget is free". The ten commits between the two runs
include [#700](https://github.com/moq-dev/rust2/pull/700) and
[#708](https://github.com/moq-dev/rust2/pull/708); bisect on the emulator, and check
include [#700](https://github.com/kixel-ai/rust2/pull/700) and
[#708](https://github.com/kixel-ai/rust2/pull/708); bisect on the emulator, and check
whether it fails every run before calling it a regression, since
[#693](https://github.com/moq-dev/rust2/pull/693) last fixed this test's lent bytes on
[#693](https://github.com/kixel-ai/rust2/pull/693) last fixed this test's lent bytes on
ART. A test that depends on when the GC runs is fixed by making the collection
deterministic, not by a retry.

## Closes

- [#716](https://github.com/moq-dev/rust2/issues/716) - the nightly's failure issue
- [#716](https://github.com/kixel-ai/rust2/issues/716) - the nightly's failure issue
8 changes: 4 additions & 4 deletions quest/m0/object-cache-miss.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ them from mbx's object cache, so the `mbx[cache]: object cache` line shows hits

Two queue builds on the `nixos-rust2-ci` runner (nspawn container `rust2-ci` on `nixos`)
compiled the same 55 crates and both logged 0 hits, 55 misses, 66.2 MiB stored locally:
[run 43265518031](https://github.com/moq-dev/rust2/actions/runs/43265518031) and
[run 43290025781](https://github.com/moq-dev/rust2/actions/runs/43290025781). A later one,
[run 43304642908](https://github.com/moq-dev/rust2/actions/runs/43304642908), got 17 hits
[run 43265518031](https://github.com/kixel-ai/rust2/actions/runs/43265518031) and
[run 43290025781](https://github.com/kixel-ai/rust2/actions/runs/43290025781). A later one,
[run 43304642908](https://github.com/kixel-ai/rust2/actions/runs/43304642908), got 17 hits
of 204 lookups. Each job still used 9 to 19 CPU-minutes (the `quest-gate` scopes' `Consumed`
CPU in the container journal, `journalctl -D /var/lib/nixos-containers/rust2-ci/var/log/journal`
on `nixos`, not Actions wall time) against the 65 of the 2026-11-01 baseline, so the cache is headroom, not the gate's main saving.
Expand All @@ -22,5 +22,5 @@ runs (paths, env, timestamps in the key). Reproduce by running the same build tw
container and diffing the keys mbx logs. Fix at the root, and confirm with a queue build
whose repeated crates hit.

Decided 2026-11-12 (maintainer, the pick of [#720](https://github.com/moq-dev/rust2/pull/720)):
Decided 2026-11-12 (maintainer, the pick of [#720](https://github.com/kixel-ai/rust2/pull/720)):
✅ keep this quest (rejected: drop it, since gate CPU already beats the baseline).
28 changes: 28 additions & 0 deletions quest/m0/swift-gives-up.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# [XS] api_swift waits for the error an async closure's timeout raises

## Goal

`api_swift` in `ffi/tests/fixtures.rs` passes every run: its "Rust gives up on an async
closure" check in `ffi/tests/api.swift` no longer fails intermittently.

## Plan

Found while validating [#740](https://github.com/kixel-ai/rust2/pull/740) on 2026-11-13:
`just ffi test --test fixtures` failed `api_swift` there in 2 of 4 runs, and at `main`
`7008d1d3` in 1 of 5, each time with `"futures" failed: Rust gives up on an async closure`.
The test passes alone.

Two races fit, and the fix covers both:

- The closure is empty, so it can finish before the budget runs out: `Pollable.poll` in
`ffi/runtime/rt.swift` starts the closure's Task and then loads `done` again, and
`Within::poll` in `ffi/fixtures/api/src/lib.rs` polls the inner future before checking
its budget. When the Task finishes in that window, `within(0) {}` returns `Ok(())` and
nothing throws. The closure must stay pending, such as by awaiting a stream nothing
yields to, as the check above it does.
- The check reads `threw` after a single `q.drain()`, so it also fails if the task's
resumption with the `Overflow` error reaches the queue after `drain` returned. The check
above it waits with `until { q.drain(); return got.value != 0 }`; wait the same way.

Confirm which one fails before fixing, such as by delaying the closure's Task or the
resumption, and fix the test's timing rather than retrying it.
2 changes: 1 addition & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ builds its bindings with today.
## Plan

Decided with the maintainer on 2026-10-25, from the
[spike](https://github.com/moq-dev/rust2/pull/41): the [exporter](/ffi/README.md), which
[spike](https://github.com/kixel-ai/rust2/pull/41): the [exporter](/ffi/README.md), which
turns a crate's `pub` API into bindings with no attributes, replaces the UniFFI fork,
whose feature quests are folded into the [exporter's](/quest/m1/ffi-export/README.md).

Expand Down
10 changes: 5 additions & 5 deletions quest/m1/ffi-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ moq ships. It ends once every child has merged, the last of them
## Plan

Decided with the maintainer on 2026-10-25, from the spike
([moq-dev/rust2#41](https://github.com/moq-dev/rust2/pull/41)): adopt the exporter, and fold
([kixel-ai/rust2#41](https://github.com/kixel-ai/rust2/pull/41)): adopt the exporter, and fold
the fork's paused feature quests into it.

Decided with the maintainer on 2026-10-27: this is an epic, with each item a child ranked by
Expand Down Expand Up @@ -44,8 +44,8 @@ Decided with the maintainer on 2026-11-09, in the quest audit:
Rejected: `#[doc(hidden)]` as the opt-out; exporting hidden items too.

The Swift, Python, Go, and Dart generators landed in
[#406](https://github.com/moq-dev/rust2/pull/406), [#407](https://github.com/moq-dev/rust2/pull/407),
[#411](https://github.com/moq-dev/rust2/pull/411), and [#422](https://github.com/moq-dev/rust2/pull/422),
[#406](https://github.com/kixel-ai/rust2/pull/406), [#407](https://github.com/kixel-ai/rust2/pull/407),
[#411](https://github.com/kixel-ai/rust2/pull/411), and [#422](https://github.com/kixel-ai/rust2/pull/422),
each generating the crate's own API in its language's idiom, as Kotlin does (decided with
the maintainer on 2026-11-01). Only Python skips the C ABI, since a CPython extension calls
about 40 times faster than `ctypes`; the others call C natively.
Expand Down Expand Up @@ -78,7 +78,7 @@ Decided with the maintainer on 2026-11-12, in the quest audit:

- ✅ The epic's closing work is a child, [ship](/quest/m1/ffi-export/ship.md), which alone
requires [the refusals epic](/quest/m1/ffi-refusals/README.md). Rejected: the epic
requiring it, as [#701](https://github.com/moq-dev/rust2/pull/701) left it, since an
requiring it, as [#701](https://github.com/kixel-ai/rust2/pull/701) left it, since an
epic's `Required` holds back every child, so none could start until moq's pin bump,
which waits on a rind release the maintainer holds.
- ✅ Every change that breaks the C ABI or a generated API is a child here, so it lands
Expand All @@ -93,7 +93,7 @@ Decided with the maintainer on 2026-11-12, in the quest audit:
Spike it on Go once they land.

Decided with the maintainer on 2026-11-02
([moq-dev/rust2#460](https://github.com/moq-dev/rust2/pull/460)): the RSS glibc's per-thread
([kixel-ai/rust2#460](https://github.com/kixel-ai/rust2/pull/460)): the RSS glibc's per-thread
arenas keep under Go's lent `Bytes` is the consumer's to fix with its global allocator, as
`ffi/README.md` documents. moq declares mimalloc in its exported crate, in its own tree.

Expand Down
2 changes: 1 addition & 1 deletion quest/m1/ffi-export/api-lock.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ first by kind and Rust path keeps the name and each later one takes a trailing `
old one, as `ffi/README.md` describes. With equal signatures a C caller compiles and calls
the wrong function, and the contract hash only catches a header and library from
different builds. Stable mangling was rejected when the naming rule was decided
([#599](https://github.com/moq-dev/rust2/pull/599)); this catches the break instead.
([#599](https://github.com/kixel-ai/rust2/pull/599)); this catches the break instead.

- The baseline covers every target the binding serves. `--api` writes one target's API
and refuses `--with` or a second `--target` (`ffi/src/cli.rs`), so a host-written file
Expand Down
4 changes: 2 additions & 2 deletions quest/m1/ffi-export/checks-raise.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ What the code does today:
([the binding benchmark](/bench/ffi/README.md)).
- Kotlin and Go keep a hold count of their own beside the runtime's, so a call costs four
atomic operations per handle. Swift keeps one only for its classes since
[#697](https://github.com/moq-dev/rust2/pull/697), and traps on a closed handle
[#697](https://github.com/kixel-ai/rust2/pull/697), and traps on a closed handle
(`rt.swift`'s `hold`). The bindings' counts go; the runtime's status replaces them.
- [#700](https://github.com/moq-dev/rust2/pull/700) added a fourth check, an item called
- [#700](https://github.com/kixel-ai/rust2/pull/700) added a fourth check, an item called
on a target the library is not built for, which traps in Swift (`ffi/src/swift.rs`) and
panics in Go (`ffi/src/go.rs`). AGENTS.md lists three; add it there with this change.
- Swift's `async throws` and throwing functions already exist for `Result`; a call that
Expand Down
4 changes: 2 additions & 2 deletions quest/m1/ffi-export/copy-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ more today in Kotlin, Python, Go, and Dart.
- Prove it with the api fixture's differential tests and re-measure the bench.

Decided with the maintainer on 2026-11-12, in the quest audit, for a size that differs by
target: since [#700](https://github.com/moq-dev/rust2/pull/700) one binding serves every
target: since [#700](https://github.com/kixel-ai/rust2/pull/700) one binding serves every
target, moq ships 32-bit `armv7-linux-androideabi` beside 64-bit ones, and Kotlin, Python,
and Dart share one source across them.

Expand All @@ -37,7 +37,7 @@ and Dart share one source across them.
staged API (`--api`) gains each such type's size and alignment per target, and the merge
reads them.

What this replaces, from [#710](https://github.com/moq-dev/rust2/pull/710): the C ABI's
What this replaces, from [#710](https://github.com/kixel-ai/rust2/pull/710): the C ABI's
`<T>_copy`, the IR's `Object.copy`, and Swift's class for a `Copy` object.

Public API: how every generated API holds a `Copy` type (breaking), and the staged API's
Expand Down
2 changes: 1 addition & 1 deletion quest/m1/ffi-export/lossless.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ What the audit found, each a place native Rust would have gone on:
raises.
- Integers: a Dart `u64` past `i64` reads negative; a Kotlin `usize` past a 32-bit
target's aborts (`ffi/runtime/jni.rs`'s `narrow`) since
[#689](https://github.com/moq-dev/rust2/pull/689); and a Go `*big.Int` outside `u128`
[#689](https://github.com/kixel-ai/rust2/pull/689); and a Go `*big.Int` outside `u128`
panics (`ffi_cgo.go`).
- `Hash`: Dart's `hashCode` throws on a `PartialEq` type and Kotlin's returns 0; the IR
carries no `Hash`. Export it where the type implements it.
Expand Down
4 changes: 2 additions & 2 deletions quest/m1/ffi-export/not-send.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
thread that made it: a call, poll, or drop from another thread never runs Rust code on
that value there. Three of moq's own are refused for it at moq `ffcb7cd9`: `clock::Entered`,
`clock::Rng`, and `catalog::Guard`
([#675](https://github.com/moq-dev/rust2/pull/675)). Proven per language by a fixture
([#675](https://github.com/kixel-ai/rust2/pull/675)). Proven per language by a fixture
type holding an `Rc`, called, awaited, and dropped from a second thread.

## Plan
Expand Down Expand Up @@ -36,7 +36,7 @@ an assert is fine "where a language has no concept of something being thread loc
`@unchecked Sendable`, `ffi/src/swift.rs`). Confinement is not thread affinity, though:
a Swift actor's jobs run on any thread of its pool, and a Dart isolate need not keep its
OS thread, while Rust cannot tell an `Rc` from a guard pinned to its thread, as
[#675](https://github.com/moq-dev/rust2/pull/675) calls moq's three. So a `!Send` value needs the check or the owner thread below in
[#675](https://github.com/kixel-ai/rust2/pull/675) calls moq's three. So a `!Send` value needs the check or the owner thread below in
Swift and Dart too, unless an executor pinned to the owner thread holds it; test a call
after a suspension, and through Dart's relay.
- Where a language has no stable thread, a Rust-owned thread holds the value and runs
Expand Down
Loading