Skip to main content

Crate brink_driver

Crate brink_driver 

Source
Expand description

Pipeline orchestration for the brink ink compiler.

Driver wraps a ProjectDb and provides higher-level operations: file discovery, analysis orchestration, diagnostic collection, and LIR input preparation. Both the compiler (one-shot) and LSP (long-lived) use Driver as their entry point.

Structs§

AnalysisOptions
Tooling options for analysis: the registered host manifest and the severity policy for its external checks. Defaults to no manifest.
AnalysisResult
The output of cross-file semantic analysis.
CompileProduct
Outcome of the full pipeline: compiled StoryData or the diagnostics that prevented it. Batch compile = pull this one query (spec §5).
DiagnosticReport
Partitioned diagnostics after suppression filtering.
Driver
Pipeline orchestration wrapper around ProjectDb.
FileId
Opaque identifier for a source file within a multi-file project.
GitRev
Git-revision SourceTree: reads keys/contents from a git revision via git show <rev>:<path> — the fix path for #1224’s baseline-diff bug (brink ide effects-diff --rev reading nothing because the old closure-only seam couldn’t enumerate).
LintPolicy
The resolved [lints] policy (issue #1160): per-code severity overrides plus the blanket deny-warnings flag. Bundled as its own small, cheaply-PartialEq-comparable value — rather than as two loose scalars — so brink-db’s severity-partitioning call sites can share one narrow salsa projection the same way TypePolicy already does (see brink-db’s type_policy_query/lint_policy_query doc comments for the cutoff argument).
LirProduct
Outcome of the pipeline through LIR lowering, mirroring brink-compiler’s compile_lir stage sequence exactly.
ProjectDb
Stateful incremental project database.
RealFs
Real-filesystem SourceTree: walks a root directory and enumerates .brink keys, keyed by root-relative path. Enumeration goes through the shared brink_source_tree::Walk, so it never descends into brink_source_tree::IGNORED_DIR_NAMES (target/, .git/, node_modules/ — issue #1381 hand-rolled that prune here; issue #1433 moved the enforcement into the walk itself, where it can’t be forgotten), so a stray build-output or dependency tree under root is never enumerated. read serves any key lazily off disk — it never eagerly reads the tree, so one malformed/unreadable file elsewhere under root cannot fail a read of an unrelated key (issue #1357).

Enums§

Dialect
Compiler dialect: gates T1b brink-extension syntax. Default StrictInk — divergence from the oracle-anchored ink subset is a visible, one-time, per-project choice (docs/t1b-surface-spec.md §1).
DiscoverError
Errors from file discovery.
LintLevel
A [lints] table entry’s severity (issue #1160) — mirrors Rust’s own [lints] levels. Warn is every diagnostic code’s implicit level when [lints] doesn’t mention it, so it doubles as this type’s Default.
TypePolicy
types project policy (docs/typed-mode-spec.md §1). Gradual is the pre-flip behavior — Unknown unifies with anything, annotations are optional seasoning, and the strict checks do not run. Strict requires dialect = brink.

Traits§

SourceTree
A source of .brink files: enumerate what exists under a root (held by the implementation since construction — see the module docs), and read any key, whether or not enumeration returned it.

Functions§

effective_severity
The severity a diagnostic code should actually be reported at, given the project’s types policy and resolved [lints] policy — the single seam every diagnostic-partitioning site must call instead of the raw brink_ir::DiagnosticCode::severity default.
is_native
Whether path is a native .brink source file — an extension test only, matching brink-db’s internal file_language classification. This is the dispatch every discovery caller (brink-compiler’s prepare_driver, brink-cli’s load_git_baseline) uses to pick discover_native + RealFs/GitRev (native) over crate::Driver::discover (ink, INCLUDE BFS).
native_source_root
Resolve a project’s source root from an entry file’s path: the directory containing the nearest brink.toml found by walking up from the entry (brink-project-config’s discovery), or — if none exists — the entry’s own directory (decision-log 2026-07-22 “native module identity … source root”: the explicit, documented single-file-project mode, not a silent fallback).
native_source_root_with_warnings
Like native_source_root, but additionally reports warnings when the bounded walk stepped over a brink.toml. Returns both the resolved root and any discovery warnings that should be reported to the user.
relative_key
Convert path to the root-relative key RealFs/GitRev would key it under — the inverse of “join root with a key,” used by discovery callers to look up the FileId a just-discovered entry landed on. Both root and path are lexically absolutized first (via std::path::absolute, which resolves ./.. without touching the filesystem) so the strip is exact regardless of how each was spelled relative to the process’s cwd — e.g. root = ".", path = "story/main.brink" and root = "story", path = "./story/main.brink" both key as "story/main.brink".