Files
foxhunt/.cargo/config.toml
jgrusewski a72c5743fe build(ci): install wild linker, swap from mold in CI compile step
wild (https://github.com/davidlattimore/wild) is a Rust-native linker,
typically 10-30% faster than mold on large release-LTO links. We have
~5 service binaries each doing release-LTO link, so the saving is
meaningful: ~30-90 sec wall-time on a fresh compile.

Approach (CI-only swap, zero local-dev impact):
1. Dockerfile.ci-builder-cpu installs wild 0.8.0 alongside mold (both
   linkers present; revert path is trivial).
2. .cargo/config.toml keeps `-fuse-ld=mold` as the file default so
   `cargo build` works locally without requiring wild on PATH.
3. compile-and-deploy-template.yaml's compile-services script does an
   in-place sed substitution `mold -> wild` immediately before
   `cargo build`, gated on `command -v wild` so a missing binary
   silently falls back to mold instead of failing the build.

Why sed-in-script over RUSTFLAGS env var: RUSTFLAGS env var REPLACES
the entire target.<triple>.rustflags array (per cargo docs precedence:
env > target > build, mutually exclusive — they do NOT merge), which
would silently drop our existing -Wl,-z,relro/--as-needed/target-cpu
flags. Sed swap edits one token while preserving everything else.

Validation:
- python3 yaml.safe_load_all parses the template
- cargo check --workspace --release --locked succeeds locally (still
  using mold per the unchanged config.toml default)
- Dockerfile syntax visually verified; wild tarball URL confirmed live
  via curl https://api.github.com/repos/davidlattimore/wild/releases/latest

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 10:22:25 +02:00

54 lines
1.9 KiB
TOML

[env]
SQLX_OFFLINE = "false"
# GPU tests deadlock under parallel execution (shared CUDA context + 4GB RTX 3050).
# Single-threaded by default; CI overrides via RUST_TEST_THREADS in workflow.
RUST_TEST_THREADS = "1"
[cargo-new]
vcs = "none"
[net]
git-fetch-with-cli = true
[build]
# jobs: omitted → cargo uses all logical CPUs (scales to any machine)
# incremental: rely on per-profile defaults (false for release, true for dev/test).
# A workspace-wide override here forced incremental ON for --release too, which
# (a) bloats release artifacts with incremental metadata for no runtime benefit,
# (b) disables sccache caching for Rust (documented limitation).
pipelining = true
rustflags = [
"-D", "unsafe_op_in_unsafe_fn",
"-D", "clippy::undocumented_unsafe_blocks",
"-W", "rust_2024_idioms",
"-C", "force-frame-pointers=yes",
"-C", "relocation-model=pic",
]
[term]
verbose = false
progress.when = "auto"
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
# mold is the default for local + CI. CI optionally swaps to `wild`
# via an in-script sed before `cargo build` (see compile-and-deploy
# WorkflowTemplate); both linkers are installed in
# Dockerfile.ci-builder-cpu. Keeping mold as the file default means
# local dev works out-of-the-box with the more widely packaged linker.
"-C", "link-arg=-fuse-ld=mold",
"-C", "link-arg=-Wl,-z,relro,-z,now",
"-C", "link-arg=-Wl,--as-needed",
# AVX2/FMA baseline — matches both Scaleway L4/H100 and most dev machines
"-C", "target-cpu=x86-64-v3",
"-C", "target-feature=+avx2,+fma,+bmi2",
# opt-level and codegen-units are set per-profile, NOT here.
# Setting them here would override ALL profiles (dev/test included),
# forcing full O3 + single-thread codegen on test builds.
]
# Profile definitions live in Cargo.toml — [profile.*] blocks in config.toml
# are silently ignored by Cargo. Do NOT add profiles here.