NOTE: The bug links below, of the form b/123456
, are for Google-internal tracking purposes.
What follows is an overview of the major features Crubit does and does not support. The list is necessarily incomplete, because there exist more features and types than could be feasibly listed in anything readable, but it should give a rough idea.
This page should evolve over time:
See /types for more details about types in general, including explanations of what it means for a type to be ABI-compatible versus layout-compatible.
Unless otherwise specified, the types below are supported and ABI-compatible (see /types/primitive, /types/pointer):
std::string_view
/ absl::string_view
std::string
&str
(i32, i64)
)std::optional<T>
absl::Status
We have experimental unreleased support for the following types:
MaybeUninit<T>
, which are treated as T
.We have planned support for the following types:
*const [T]
, *mut [T]
Option<T>
std::vector
std::unique_ptr
The following types are not yet supported, among many others:
!
std::array<T, N>
, [T; N]
)i128
and u128
String
Result<T, E>
()
as anything but a return type.std::byte
For C++ libraries, used from Rust, we have support for the following language features, used in public interfaces:
[[clang::trivial_abi]]
)We have experimental unreleased support for the following language features:
vector<int>
becomes struct __crubit_mangled_vector_i
, not struct vector<T>(...)
The following features are not supported yet, among many others:
using
aliasesFor Rust libraries, used from C++, we have support for the following language features, used in public interfaces:
repr(C)
unionsuse
, type
)Clone
Default
Drop
From
const
constantsWe have experimental unreleased support for the following language features:
repr(C)
unionsThe following features are not supported yet, among others:
const
constantsCrubit was initially written to take advantage of the superpowers that come with a centrally controlled monorepo using a Bazel build system. However, this presents a high barrier to entry: in order to use Crubit, you must satisfy all of the preconditions.
In 2026, we are building Crubit up to be a tool shaped like OSS users expect: an IDL-based FFI tool with Cargo integration, with options for a better experience in codebases with strong control over the build environment. (Though for calling Rust from C++, we might stop short of an IDL, and instead rely on compiler-synced binary releases, since there is only one compiler.)
In particular, this involves decomposing Crubit into a collection of parts that can be used on their own, without needing to consume the whole:
By using an IDL as input, instead of a C++ compiler frontend, Crubit can be made compatible with arbitrary C++ compilers: a human can write the IDL in a way that is compatible with the compiler in question, even if Crubit does not integrate with that compiler yet.
For the Rust compiler, however, there is only one. The main toolchain integration hazard is that the compiler and its arguments must be exactly matched with the version and arguments used to compile the Rust crate itself. This can be resolved by using rmeta files as inputs, instead of source code.
TODO:
- rs_bindings_from_idl and idl_from_cc exist, and Crubit can be used with IDL inputs
- cc_bindings_from_rs can accept rmeta inputs
TODO:
- Crubit accepts pull requests and regularly reviews GitHub issues and PRs.
- A C++ stdlib crate exists in crates.io
- The Crubit
ctor
crate is either replaced withpin-init
, the equivalent standard library module, or else has a crate in crates.io with documentation and an explanation of why to use it vspin-init
.- For all other support libraries: they exist in crates.io and are documented.
We currently only support Bazel.
TODO:
- cc_bindings_from_rs builds using Cargo
- rs_bindings_from_cc builds using Cargo
- idl_bindings_from_cc, rs_bindings_from_idl build using Cargo
- Crubit is usable as a Bazel dependency
- Crubit is usable as a Bazel dependency
- Crubit builds against public Rust and Clang releases
- Crubit binary releases
- (not planned) Buck2
- (not planned) CMake