Skip to content

Fix CI: cargo fmt and static linking on macOS#106

Closed
jucasoliveira wants to merge 2 commits into
masterfrom
claude/youthful-kapitsa-691971
Closed

Fix CI: cargo fmt and static linking on macOS#106
jucasoliveira wants to merge 2 commits into
masterfrom
claude/youthful-kapitsa-691971

Conversation

@jucasoliveira

Copy link
Copy Markdown
Contributor

Fixes two CI failures. Closes #3 if applicable.

Changes

1. cargo fmt fix — src/types/inference.rs

The collect_lifetimes_from_type function had a match arm using the if-inside-block pattern, which was converted to a proper match guard. rustfmt requires the opening brace of a guarded arm to appear on a new line:

// before (fails cargo fmt --check)
Type::RefWithLifetime(id, _) | Type::MutRefWithLifetime(id, _)
    if !lifetimes.contains(id) => {
    lifetimes.push(*id);
}

// after (passes cargo fmt --check)
Type::RefWithLifetime(id, _) | Type::MutRefWithLifetime(id, _)
    if !lifetimes.contains(id) =>
{
    lifetimes.push(*id);
}

2. Static linking fix — libzstd and libunwind on macOS

Problem: The binary dynamically linked /opt/homebrew/opt/zstd/lib/libzstd.1.dylib and /opt/homebrew/opt/llvm@18/lib/libunwind.1.dylib, making the distributed artifact depend on Homebrew being installed.

Fix:

  • .cargo/config.toml: replaced -L <zstd-dir> (dynamic search path) with -C link-arg=<zstd-dir>/libzstd.a (explicit static archive) for both macOS targets.
  • release.yml / ci.yml macOS steps: added sudo rm -f .../libunwind*.dylib after installing LLVM@18, so the linker falls back to the system libunwind — matching the approach already used for the x86_64 cross-compile target.
  • release.yml x86_64 build step: switched from -L .../zstd/lib -lzstd to the static archive path.

Test plan

  • CI lint job: cargo fmt --all -- --check passes
  • CI macOS test job: cargo build --release and cargo test --release pass
  • Release aarch64 binary: otool -L shows no Homebrew dynamic libs
  • Release x86_64 binary: otool -L shows no Homebrew dynamic libs

🤖 Generated with Claude Code

jucasoliveira and others added 2 commits April 21, 2026 09:24
- Run cargo fmt on inference.rs: match guard arm now uses brace on new
  line as required by rustfmt (Type::RefWithLifetime guard pattern)
- .cargo/config.toml: link libzstd.a statically on both macOS targets
  instead of adding a dynamic library search path
- release.yml (aarch64): remove LLVM's libunwind.dylib after install so
  the linker falls back to the system libunwind, preventing homebrew
  dynamic dependency in the distributed binary
- release.yml (x86_64): switch from -lzstd with search path to explicit
  static archive path
- ci.yml (macOS): remove LLVM's libunwind.dylib in test job as well

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix VM Object Method Calls

1 participant