Automic VaultAutomic Vault

brew

使用 Homebrew, apk 安装 c2rust

查看 c2rust 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

安装

其他安装命令

macOS

Homebrew已验证 · 100%
brew install c2rust

local Homebrew formula metadata

概览

软件包摘要

Migrate C code to Rust

命令和别名

  • c2rust
  • c2rust-transpile

历史

项目历史与用法

C2Rust is a C99-to-Rust migration toolkit. Its core transpiler produces unsafe Rust that closely mirrors the original C so functionality and tests can be preserved before humans or refactoring tools gradually improve the Rust.

项目历史

The upstream Git history begins on 22 June 2017 with original C sources, Corrode-generated Rust sources, and early source-rewriting work. The README describes the project's goal as helping migrate C99-compliant code to Rust while preserving behavior first.

By the time of the README's RustConf 2018 reference, C2Rust had become a visible example of pragmatic Rust adoption for existing C codebases. The project grew beyond raw transpilation to include cross-checking translated code against the original and a refactoring tool intended to reduce the manual work of turning unsafe Rust into safer, more idiomatic Rust.

采用历史

C2Rust is packaged both as a Rust crate installed with `cargo install --locked c2rust` and through system package managers such as Homebrew and Alpine according to source_facts. The README also documents direct Git installation for users needing unreleased bug fixes.

Adoption is mostly by developers facing migration or audit work rather than everyday end users. Its requirement for LLVM/clang, compile_commands.json, and close build-system integration places it in the serious-codebase-migration category.

使用方式

For non-trivial projects, C2Rust expects a `compile_commands.json` compilation database so libclangTooling can see the same compiler arguments used by the original C build. Users run `c2rust transpile path/to/compile_commands.json`, optionally emitting Cargo build files or specifying binary entry points.

The README also documents trivial source-file transpilation, cross-checking translated code against the original, and `c2rust refactor` tooling for follow-up transformations. Developers often need LLVM_CONFIG_PATH or related environment variables when building against specific LLVM installs.

为什么软件包爱好者会关心

C2Rust is significant because it packages one of the hard parts of language migration as a CLI workflow: consume a C build database, produce Rust, run tests, then iterate. It is not magic safe Rust generation; its value is making the first migration step mechanical and reproducible.

It also represents a Rust ecosystem pattern where package-manager installation is only the entry point. Real use depends on compiler toolchains, build-system metadata, test suites, and sometimes pinned nightly Rust components for advanced refactoring tools.

时间线

  • 2017-06-22: Upstream Git history begins with original C sources and Corrode-generated Rust sources.
  • 2018: README points to a RustConf 2018 talk introducing C2Rust.
  • 2018-11-02: 0.8.1 tag appears.
  • 2020-10-20: 0.15.0 tag appears.
  • 2023-02-01: v0.17.0 tag appears.
  • 2024-08-30: v0.19.0 tag appears.
  • 2025-02-24: v0.20.0 tag appears.
  • 2026-02-10: v0.22.1 tag appears.

Related projects

  • Corrode: an earlier C-to-Rust translator referenced in C2Rust's initial upstream history.
  • LLVM and clang/libclangTooling: parser and compilation-database infrastructure required by C2Rust.
  • c2rust-refactor: sibling tool for transforming generated Rust after transpilation.
  • Compiler Explorer: the README links an online C2Rust translator integration using the current master branch.

安全态势

风险级别:绿色

narrow executable package without higher-risk signals.

风险分类器

绿色 风险 · 低 置信度 · appliance

原因

  • narrow executable package without higher-risk signals

信号

  • metadata:no-higher-risk-signals

安装行为

  • formula 元数据中未记录 Homebrew post-install 钩子。
  • Homebrew bottle 元数据适用于 6 个平台目标。
  • 安装时包含 1 个运行时依赖。
  • 构建元数据列出 2 个构建依赖。

建议审查

在无人值守的代理使用前,请检查该工具是否读取明文凭据、写入远程状态、发布制品或调用插件。

可执行文件

已安装的可执行文件

命令类型暴露范围备注
c2rustcli全局可执行文件
c2rust-transpilecli全局可执行文件

新鲜度

版本和新鲜度

这些信号区分页生成时间、软件包管理器活动和上游发布比较。只有存在证据 URL 和可比较版本时,才会提示版本落后。

页面生成时间2026-07-10
管理器版本0.22.1
管理器更新时间
本地数据OK
上游当前
检测到的最新版本v0.22.1

https://github.com/immunant/c2rust

  • 信息No package-manager update timestamp was available.低 置信度

安装元数据

软件包元数据

软件包键brew:c2rust
版本0.22.1
软件包管理器Homebrew
软件包管理器页面https://formulae.brew.sh/formula/c2rust
主页https://c2rust.com/
仓库https://github.com/immunant/c2rust
上游文档https://c2rust.com/manual
许可证BSD-3-Clause
源码归档https://github.com/immunant/c2rust/archive/refs/tags/v0.22.1.tar.gz
依赖llvm@21
构建依赖cmake, rust
Bottle可用 (于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux)
Homebrew post-install未定义
服务未声明

注册表事实

源数据库详情

Source DatabaseHomebrew formula API
Taphomebrew/core
Full Namec2rust
Version Scheme0
Revision1
Bottle Stable Root URLhttps://ghcr.io/v2/homebrew/core
Deprecatedno
Disabledno
Keg Onlyno
URL Keys
  • stable

源数据库匹配

其他软件包管理器记录

匹配项来自外部软件包管理器索引,并与本地 Automic Vault 软件包链接分开显示。

apk95%

c2rust 0.22.1-r0

Transpile C99-compliant code to (unsafe) Rust code

https://github.com/immunant/c2rust

sudo apk add c2rust
  • License: BSD-3-Clause
  • Architecture: x86_64
  • Source Package: c2rust
  • 1 依赖
  • 1 提供
  • normalized package name match
  • 匹配方式:C2rust
Alpine Linux edge package indexes · dl-cdn.alpinelinux.org · Alpine Linux edge package indexes: c2rust from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

来源线索

由仓库数据生成

此页面由 av-webscripts/generate-pkg-sqlite.py 生成的私有软件包 SQLite 工件提供。

使用的来源

  • Geiger risk classifier
  • Nucleus package database
  • av.db category and tag curation
  • cross-ecosystem install command graph
  • curated package history
  • external package-manager database matches
  • package relationship graph
  • package version freshness
  • package-page enrichment