Expand description
Lean 4 toolchain discovery, fingerprinting, allowlist re-export, and build-script helpers.
Sits one layer above the workspace crate lean_rs_sys, which owns the raw extern "C"
declarations, the hand-written refcount inline helpers, the signature-checked symbol
allowlist, the header SHA-256 digest, and the link directives. This crate composes on top:
a typed ToolchainFingerprint, the workspace-only Lake LAKE_FIXTURE_DIGEST, a layered
LinkDiagnostics error type, and reusable build-script helpers
(emit_lean_link_directives_checked, build_lake_target,
build_lake_target_quiet) that downstream embedders and higher layers can use to get
consistent link/rerun directives and Lake dylib paths without duplicating policy.
§Single typed entry point
LEAN_VERSION, LEAN_HEADER_PATH, and LEAN_HEADER_DIGEST are re-exported from
lean_rs_sys so embedders that depend on this crate need only one import for build
metadata. The allowlist comes through required_symbols (no copy).
§Layering
lean-rs-sys → lean-toolchain → lean-rs. Raw lean_* symbols never appear in this
crate’s public surface — they remain in lean-rs-sys and reach the safe layers through
lean-rs’s pub(crate) modules.
Structs§
- Built
Lean Capability - Metadata produced by
CargoLeanCapability. - Cargo
Lean Capability - Build-script helper for shipping a Rust crate with bundled Lean code.
- Discover
Options - Knobs that gate which discovery probes run.
- Lean
Lake Project Modules - A discovered Lake project and its Lean modules.
- Lean
Module Descriptor - A discovered Lean source module in a Lake project.
- Lean
Module Discovery Options - Options for Lake module discovery.
- Lean
Module SetFingerprint - Stable facts about the discovered project source set.
- Toolchain
Fingerprint - Typed identity of the Lean toolchain this crate was compiled against.
- Toolchain
Info - Outcome of a successful discovery.
Enums§
- Discovery
Source - Which probe produced the resolved toolchain.
- Lean
Module Discovery Diagnostic - Typed diagnostics for Lake module discovery.
- Link
Diagnostics - Reasons the Lean toolchain or its linkage could not be resolved.
Constants§
- CAPABILITY_
MANIFEST_ SCHEMA_ VERSION - Current JSON schema version for
CargoLeanCapabilityartifact manifests. - HOST_
TRIPLE - Cargo
TARGETtriplelean-toolchainwas built for. - LAKE_
FIXTURE_ DIGEST - SHA-256 over the workspace Lake fixture’s manifest plus compiled native artifacts.
- LEAN_
HEADER_ DIGEST - SHA-256 of the resolved
lean.h. Computed bybuild.rsand equal to theheader_digestof the matchedSupportedToolchainentry. - LEAN_
HEADER_ PATH - Filesystem path to the
lean.hthat the build was resolved against. - LEAN_
VERSION LEAN_VERSION_STRINGas read from the active toolchain’sversion.h(e.g."4.29.1").- VERSION
- Version of the
lean-toolchaincrate, matchingCargo.toml.
Functions§
- build_
lake_ target - Build a Lake
lean_libshared-library target and return the produced dylib path. - build_
lake_ target_ quiet - Build a Lake
lean_libshared-library target without emitting Cargo build-script directives. - capability_
env_ var - Default Cargo environment variable for a Lean capability target.
- capability_
manifest_ env_ var - Default Cargo environment variable for a Lean capability artifact manifest.
- discover_
lake_ modules - Discover Lean modules in a Lake project.
- discover_
toolchain - Resolve a Lean toolchain following the documented probe precedence.
- emit_
lean_ link_ directives - Emit Lean link-search, link-lib, and runtime rpath directives plus
matching rerun triggers from a downstream
build.rs. - emit_
lean_ link_ directives_ checked - Emit Lean link-search, link-lib, and runtime rpath directives, returning typed diagnostics if the active Lean toolchain cannot be resolved.
- lake_
target_ declared - Return whether a Lake
lean_libtarget is declared in a project. - required_
symbols - Curated allowlist of
LEAN_EXPORTsymbols the workspace relies on.