diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9b3a19ca..e57b900d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -28,3 +28,10 @@ updates: cooldown: default-days: 7 semver-major-days: 14 + - package-ecosystem: rust-toolchain + directory: / + labels: + - dependencies + - rust-toolchain + schedule: + interval: weekly diff --git a/AGENTS.md b/AGENTS.md index 2c02fa75..f16098f0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -393,3 +393,12 @@ The following tooling is available in this environment: These practices help maintain a high-quality codebase and facilitate collaboration. + +## Fast development builds + +`make dev-build` and `make dev-test` compile with the opt-in Cranelift +backend and the mold linker configured in `tools/dev-fast/config.toml`. +They require a nightly toolchain and, on Linux, a `mold` binary on the +`PATH`. The fragment is passed explicitly with `--config`, so release, +coverage, and verification builds are unaffected; never copy its contents +into `.cargo/config.toml`, which Cargo applies to every build. diff --git a/Makefile b/Makefile index 223a46ae..2f964dce 100644 --- a/Makefile +++ b/Makefile @@ -114,3 +114,14 @@ test-workflow-contracts: ## Validate the mutation-testing caller contract help: ## Show available targets @grep -E '^[a-zA-Z_-]+:.*?##' $(MAKEFILE_LIST) | \ awk 'BEGIN {FS=":"; printf "Available targets:\n"} {printf " %-20s %s\n", $$1, $$2}' + +# Opt-in accelerated debug builds (Cranelift + mold); requires a nightly +# toolchain. See AGENTS.md and tools/dev-fast/config.toml. +DEV_FAST_CONFIG ?= tools/dev-fast/config.toml + +.PHONY: dev-build dev-test +dev-build: ## Build debug binaries with Cranelift and mold + cargo --config "$(DEV_FAST_CONFIG)" build + +dev-test: ## Run tests with Cranelift and mold + cargo --config "$(DEV_FAST_CONFIG)" test diff --git a/tools/dev-fast/config.toml b/tools/dev-fast/config.toml new file mode 100644 index 00000000..01e7f899 --- /dev/null +++ b/tools/dev-fast/config.toml @@ -0,0 +1,31 @@ +# Canonical opt-in Cargo configuration fragment for accelerated local debug +# builds. +# +# This configuration is deliberately kept out of `.cargo/config.toml`. +# Cargo auto-discovers that path, so anything placed there applies to +# release packaging, coverage, and verification builds, which must keep +# the supported LLVM backend and platform linker. In a consuming +# repository this fragment lives at `tools/dev-fast/config.toml` and is +# passed explicitly with `cargo --config tools/dev-fast/config.toml ...` +# from `make dev-build` and `make dev-test`. +# +# Repositories that set repository-wide `rustflags` in `.cargo/config.toml` +# must restate them in the target table below. Cargo joins the rustflags of +# every matching `[target.*]` entry (target-triple and `cfg` tables alike), +# but the joined target rustflags take precedence over `[build].rustflags` +# rather than merging with it. + +[unstable] +codegen-backend = true + +# Cranelift trades runtime performance for compile speed, so it applies to +# the dev profile only. The `make dev-*` targets never build release +# artefacts. +[profile.dev] +codegen-backend = "cranelift" + +# mold ships for Linux only, so the flag is gated behind a target `cfg`. On +# macOS and Windows the table simply does not apply and the platform default +# linker is used. +[target.'cfg(target_os = "linux")'] +rustflags = ["-Clink-arg=-fuse-ld=mold"] diff --git a/typos.local.toml b/typos.local.toml index 3be73cfc..471faf36 100644 --- a/typos.local.toml +++ b/typos.local.toml @@ -10,6 +10,13 @@ accepted = [] [patterns] ignore = [ + # "mold" names the linker (https://github.com/rui314/mold) in these + # contexts only; the mould correction stays active elsewhere. + "-fuse-ld=mold", + "mold linker", + "Cranelift \\+ mold", + "Cranelift and mold", + "`mold`", '\bCARGO_TERM_COLOR\b', 'types: \[[^]]*\blabeled\b', 'GitHub Flavored\s+Markdown', diff --git a/typos.toml b/typos.toml index 538a6597..4e31dc96 100644 --- a/typos.toml +++ b/typos.toml @@ -35,7 +35,10 @@ extend-ignore-re = [ "&mut initialised\\b", "(?:::|\\.)canonicalise\\b", "(?s)```.*?```", + "-fuse-ld=mold", "Azure Architecture\\s+Center", + "Cranelift \\+ mold", + "Cranelift and mold", "GitHub Flavored\\s+Markdown", "Header-only C\\+\\+/python library for fast approximate\\s+nearest neighbors", "\\.finalise\\b", @@ -56,6 +59,8 @@ extend-ignore-re = [ "\\brust-analyzer\\b", "\\n\\s*initialised,\\n", "`[^`\\n]+`", + "`mold`", + "mold linker", "types: \\[[^]]*\\blabeled\\b", ]