Expand description
Compilation pipeline orchestration for Nova.
Drives source → lex → parse → resolve → typecheck → MIR →
Cranelift (JIT for nova run, object emission + native linking for
nova build), rendering diagnostics from every stage through
nova-diagnostics. This is the crate behind nova run,
nova build, and nova check.
Structs§
- Analysis
- What
analyzefound. - Checked
- What
check_program_countedrendered. - Disk
Sources - Reads every module from disk: the CLI’s sources.
- Embedded
Runtime - The runtime library a
novacarries, as its build script embedded it. - Options
- What
analyzedoes beyond checking. - Probe
- A place in one of the program’s files.
- Program
- What to load (spec §4.4).
- Root
- A file the loader starts from.
Enums§
- Outcome
- Outcome of a pipeline invocation that may fail with user errors.
- Root
Kind - Where a root is.
- Roots
- The roots a command takes (spec §4.4’s table), each only if it exists.
Constants§
- DOC_
TEST_ FUNCTION - The test function each doc test module adds (spec
docs/superpowers/specs/2026-10-11-phase-3-5b-doc-tests-design.md§5.2): in a program of doc tests, the only@testfunction collected. Each module is its own namespace, so each can use this name.
Traits§
- Sources
- Where
analyzereads a module’s text.
Functions§
- analyze
- Run the front end on
entryfor the language server (spec §3): the programProgram::for_filefinds for it. - analyze_
program - Run the front end on
program(spec 3.3a §4.4, §6). MIR runs only when the program runs andoptions.module_onlyis off. - build_
file - Compile a file to a standalone native executable (
nova build). - build_
file_ release - Compile a file to an optimized standalone executable via the LLVM backend
(
nova build --release). - build_
program build_fileonprogram.- build_
program_ release build_file_releaseonprogram.- build_
test_ binary - Compile
pathas a test binary (nova test, Task 5):mainis synthesized to dispatch to exactly one collected@testby index (Builtin::TestSelector) rather than to the file’s ownmain— a test file need not define one, since a missingmainis enforced only at MIR lowering (E0601innova_mir::lower_module), which the synthesized function supplies before that check ever runs. - build_
test_ program build_test_binaryonprogram: the test binary of its roots.- build_
test_ program_ with build_test_program, reading every module throughsources, and passing each diagnostic throughmapbefore it is counted and rendered (spec 3.5b §7, §11.2). Doc tests are modules no file holds.- check_
file - Type-check a file, printing diagnostics.
Outcome::Ok(())means the program is well-formed and would compile. - check_
program check_fileonprogram(spec 3.3a §5.1). MIR runs only when the program runs: its entry issrc/main.nova, or a loose file.- check_
program_ counted check_program, counting the errors and warnings it rendered. Publishing’s verification fails on either (spec 3.3b §6.6).- compile_
file - Compile a file to native code via the Cranelift JIT.
- compile_
program compile_fileonprogram.- package_
of - The package
pathis a module of, and where in it, whenpathis directly in thesrc/ortests/of a directory holding anova.toml(spec §4.1). The language server finds its projects the same way. - run_
file - Compile and immediately execute a file (
nova run), withargsas the program’s arguments:std/process’sargs()returns exactly this list. - run_
program run_fileonprogram.- set_
embedded_ runtime - Record the runtime this
novacarries. nova-cli calls this once, at startup. An empty payload records nothing, so the lookup goes on to the executable’s neighbours. - std_
source - The text of the std module a program’s
FileDbnamesname, such as<std/time>, orNonefor any other name. The build adds std’s modules to the database only after loading, so aMapDiagnosticthat shows a diagnostic in one, as a std doc test’s does (spec 3.5b §7), reads its text here.
Type Aliases§
- MapDiagnostic
- Rewrites a diagnostic before it is counted and rendered, with the
program’s files at hand (spec
docs/superpowers/specs/2026-10-11-phase-3-5b-doc-tests-design.md§7): it may move the diagnostic’s labels into other files of the database, adding them.falsehides a warning; an error is always shown.