Skip to main content

Crate nova_driver

Crate nova_driver 

Source
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 analyze found.
Checked
What check_program_counted rendered.
DiskSources
Reads every module from disk: the CLI’s sources.
EmbeddedRuntime
The runtime library a nova carries, as its build script embedded it.
Options
What analyze does 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.
RootKind
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 @test function collected. Each module is its own namespace, so each can use this name.

Traits§

Sources
Where analyze reads a module’s text.

Functions§

analyze
Run the front end on entry for the language server (spec §3): the program Program::for_file finds for it.
analyze_program
Run the front end on program (spec 3.3a §4.4, §6). MIR runs only when the program runs and options.module_only is 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_file on program.
build_program_release
build_file_release on program.
build_test_binary
Compile path as a test binary (nova test, Task 5): main is synthesized to dispatch to exactly one collected @test by index (Builtin::TestSelector) rather than to the file’s own main — a test file need not define one, since a missing main is enforced only at MIR lowering (E0601 in nova_mir::lower_module), which the synthesized function supplies before that check ever runs.
build_test_program
build_test_binary on program: the test binary of its roots.
build_test_program_with
build_test_program, reading every module through sources, and passing each diagnostic through map before 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_file on program (spec 3.3a §5.1). MIR runs only when the program runs: its entry is src/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_file on program.
package_of
The package path is a module of, and where in it, when path is directly in the src/ or tests/ of a directory holding a nova.toml (spec §4.1). The language server finds its projects the same way.
run_file
Compile and immediately execute a file (nova run), with args as the program’s arguments: std/process’s args() returns exactly this list.
run_program
run_file on program.
set_embedded_runtime
Record the runtime this nova carries. 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 FileDb names name, such as <std/time>, or None for any other name. The build adds std’s modules to the database only after loading, so a MapDiagnostic that 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. false hides a warning; an error is always shown.