Skip to content
Topaz6.0 · Before release
Download

Search documentation

Specification 6.0 · Not released · Tested product 5.21.3

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Tools

    emit

    Emits generated Rust source for inspection and integration.

    Invocation, options and results

    Link

    topaz emit

    Synopsis
    1. topaz emit [entry]

    Input

    topaz emit [entry] accepts one optional source entry. Without an entry it loads the package at --root <dir>, defaulting to the current directory. With an entry, the default root is its directory.

    The output target is rust. --target rust selects it explicitly and any other target is rejected. Without --out-dir, the primary source is written to standard output. With --out-dir <dir>, the directory value must be nonempty.

    --compiler selects self or rust. --backend selects boxed or native. The defaults are self and boxed. Native lowering requires --compiler rust.

    --native-report-json <file> requires native lowering and a nonempty file path. It requests a separate lowering report and does not select JSON presentation for emitted source.

    A package with a reached Lispex application requires --out-dir so that its runtime closure can accompany the generated source. Program arguments, --run, --release, output-format options, missing values, repeated options, attached values, and additional entries are rejected.

    Options and conflicts

    OptionDefaultContractConflicts
    --compiler rust|selfself

    compiler selector (default self); rust selects the reference compiler Also rejects combination with --producer, --self-source.

    None listed
    --lockedfalse

    Verify topaz.lock before compiling the selected package.

    None listed
    --verbosefalse

    Reports the selected compiler and whether it was explicit or the default. For version, prints the detailed release report.

    None listed
    --root <dir>entry directory; . in package mode

    The explicit source root or package root for this invocation.

    None listed
    --out-dir <dir>Not specified

    expose generated Rust source for inspection/integration (--target rust); print the primary source to stdout, or write the complete source set with --out-dir <dir> (--root <dir>; no entry = package mode)

    None listed
    --native-report-json <file>Not specified

    checked native emit/build only: atomically write a deterministic lowering decision report without changing normal output or artifacts --native-report-json requires --backend native

    None listed
    --backend boxed|nativeboxed

    emit/build: lowering backend (default boxed). Native specialization requires --compiler rust.

    None listed
    --target rustrust

    emit only: generated source target (default rust)

    None listed
    --language-version <5.21>5.21

    language version selector

    None listed
    --compiler-memory-mib <MiB>8192

    self compiler worker memory budget (8192); overrides TOPAZ_COMPILER_MEMORY_MIB A positive integer is required. Environment input: TOPAZ_COMPILER_MEMORY_MIB.

    None listed
    --compiler-time-ms <ms>1800000

    self compilation wall-clock budget (1800000); overrides TOPAZ_COMPILER_TIME_MS A positive integer is required. Environment input: TOPAZ_COMPILER_TIME_MS.

    None listed

    Output channels

    stdout

    stderr

    Exit status

    0

    The requested source stream or complete crate was emitted successfully.

    1

    Invalid arguments, input or lock failures, parsing, resolution, checking or lowering failures, unsupported compiler or profile combinations, resource exhaustion, missing runtime components, and output or report write failures.

    Effects

    The command reads the selected source and applicable package inputs. Emitting to standard output creates no output crate. Compiler workspaces may be created by the selected compiler.

    --out-dir creates the crate directory and writes the generated crate files and admitted runtime closure. Existing files with generated paths may be replaced. Files outside the chosen output directory are not crate outputs.

    The optional native report is staged and published at its explicit path. It does not grant authority to modify the input manifest or lock. A failed crate write can leave files already written during that invocation.

    Emission uses local package content and the installed runtime closure without network access. It neither invokes Cargo to build the crate nor executes the generated program.

    Identical source and package bytes, lock identities, compiler, language mode, backend, and runtime components produce identical generated source and crate content. Generated content does not depend on enumeration order, wall-clock time, or a random workspace name.

    Diagnostics can include input paths and the completion line includes the chosen destination. Comparing those streams requires the same path inputs.

    --locked verifies an existing package lock before compilation. Registry dependencies and Lispex configuration require it. Missing or mismatched dependencies fail rather than being materialized.

    Emission leaves topaz.toml and topaz.lock unchanged. The generated crate's Cargo.lock binds its embedded Rust runtime closure and does not replace the Topaz package lock.

    Operation

    Link

    Choose an output directory when the complete source set is needed. Standard output carries the primary generated source.

    Option conditions

    Link

    --target applies to emit, build, or init only

    --backend native applies to emit/build only

    --native-report-json applies to emit/build only

    --native-report-json requires --backend native

    --locked applies to package-mode check, run, emit, build, test, doc, bench, compiler observe, compiler preview. Selected-entry test also accepts it when --root contains topaz.toml.

    --compiler cannot be combined with bootstrap --producer or --self-source

    a reached Lispex application requires emit --out-dir so its exact conditional runtime closure can be written

    Behavior contract

    Link
    Ruletools-commands-emit.rule.behavior

    Command behavior

    Arguments and rejection

    topaz emit [entry] accepts one optional source entry. Without an entry it loads the package at --root <dir>, defaulting to the current directory. With an entry, the default root is its directory.

    The output target is rust. --target rust selects it explicitly and any other target is rejected. Without --out-dir, the primary source is written to standard output. With --out-dir <dir>, the directory value must be nonempty.

    --compiler selects self or rust. --backend selects boxed or native. The defaults are self and boxed. Native lowering requires --compiler rust.

    --native-report-json <file> requires native lowering and a nonempty file path. It requests a separate lowering report and does not select JSON presentation for emitted source.

    A package with a reached Lispex application requires --out-dir so that its runtime closure can accompany the generated source. Program arguments, --run, --release, output-format options, missing values, repeated options, attached values, and additional entries are rejected.

    Output

    Without --out-dir, standard output contains the primary UTF-8 generated Rust source and no human banner. Standard error carries diagnostics and requested verbose compiler details.

    With --out-dir, standard output is empty and standard error identifies the completed self-contained crate. The crate contains generated source, Cargo.toml, Cargo.lock, pinned toolchain information, the vendored runtime closure, and source-distribution notices.

    --format json is rejected because emit has no JSON report mode. The optional native lowering report is written to its requested file with schema identifier topaz.native-lowering-report.v1. It does not change ordinary output channels.

    No source output is produced for an argument, package, resolution, checking, or lowering failure. A later output I/O error can leave a partial stream or partially written crate and is reported as failure.

    Exit status

    Exit code 0 means the requested source stream or complete crate was emitted successfully.

    Exit code 1 covers invalid arguments, input or lock failures, parsing, resolution, checking or lowering failures, unsupported compiler or profile combinations, resource exhaustion, missing runtime components, and output or report write failures.

    Filesystem effects

    The command reads the selected source and applicable package inputs. Emitting to standard output creates no output crate. Compiler workspaces may be created by the selected compiler.

    --out-dir creates the crate directory and writes the generated crate files and admitted runtime closure. Existing files with generated paths may be replaced. Files outside the chosen output directory are not crate outputs.

    The optional native report is staged and published at its explicit path. It does not grant authority to modify the input manifest or lock. A failed crate write can leave files already written during that invocation.

    Network access

    Emission uses local package content and the installed runtime closure without network access. It neither invokes Cargo to build the crate nor executes the generated program.

    Reproducibility

    Identical source and package bytes, lock identities, compiler, language mode, backend, and runtime components produce identical generated source and crate content. Generated content does not depend on enumeration order, wall-clock time, or a random workspace name.

    Diagnostics can include input paths and the completion line includes the chosen destination. Comparing those streams requires the same path inputs.

    Packages and locks

    --locked verifies an existing package lock before compilation. Registry dependencies and Lispex configuration require it. Missing or mismatched dependencies fail rather than being materialized.

    Emission leaves topaz.toml and topaz.lock unchanged. The generated crate's Cargo.lock binds its embedded Rust runtime closure and does not replace the Topaz package lock.

    Why

    Emitting source supports inspection and integration, while building requests an executable artifact. These intentions remain distinct even when a later external build produces the same program. The lowering report is also distinct from the emitted source.

    Source evidence

    The linked public CLI recipe checks the exact displayed argument rejection before the requested operation. It does not execute the successful operation or verify its effects.

    Successful source emission and crate creation are outside the exact reviewed execution allowlist. The linked safe recipe rejects an invalid target. Runtime closure and artifact checks remain for the administrator's CI rather than new unreviewed runner arguments.

    Example contract

    Link
    Ruletools-commands-emit.rule.invocation

    Example contract

    The invocation topaz emit main.tpz --language-version 5.21 --target invalid is expected to exit with 1.

    Reject an unsupported target during argument validation before producing source, building a program, or creating a binary.

    Why

    An output target selects the representation of the generated program. Rejecting an unknown target prevents the command from producing a different representation than requested.

    Source evidence

    Example

    Link

    Argument-rejection example

    Link
    main.tpzArgument-rejection exampleOpen in Playground
    1. function identity<T>(value: T) -> T {
    2. value
    3. }
    target product 5.21.3
    Expected result

    Expected result

    Textual rejection details remain Pending in the reference model. The independent Tools example gate expects exit 1.

    Reject an unsupported target during argument validation before producing source, building a program, or creating a binary.

    Source evidence

    Verification scope

    Link

    Observed with Topaz 5.21.3 on 2026-11-06T08:36:29.642Z. This invocation passed; exit 1. 3 assertions were evaluated against the independent expected result. Execution record. This result covers the displayed invocation.

    Related references

    Link

    Compiler selection

    Packages, locks and targets

    Menu

    Download