diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py
index 7fef6643ff..35cf538e85 100755
--- a/.github/scripts/strategy-matrix/generate.py
+++ b/.github/scripts/strategy-matrix/generate.py
@@ -12,7 +12,6 @@ _BASE_CMAKE_ARGS = [
"-Dwerr=ON",
"-Dxrpld=ON",
"-Dwextra=ON",
- "-Drust=ON",
]
# Maps sanitizer names (as used in cmake) to short config-name suffixes.
diff --git a/.github/workflows/reusable-clang-tidy.yml b/.github/workflows/reusable-clang-tidy.yml
index e2e7007c72..ceda062604 100644
--- a/.github/workflows/reusable-clang-tidy.yml
+++ b/.github/workflows/reusable-clang-tidy.yml
@@ -87,7 +87,6 @@ jobs:
-Dwerr=ON \
-Dxrpld=ON \
-Dverify_headers=ON \
- -Drust=ON \
..
- name: Build clang-tidy prerequisites
@@ -95,12 +94,6 @@ jobs:
run: |
ninja -j ${{ steps.nproc.outputs.nproc }} tidy_prerequisites
- # clang-tidy needs cxxbridge headers generated from Rust crates
- - name: Build xrpl_crates
- working-directory: ${{ env.BUILD_DIR }}
- run: |
- ninja -j ${{ steps.nproc.outputs.nproc }} xrpl_crates
-
- name: Run clang tidy
id: run_clang_tidy
continue-on-error: true
diff --git a/BUILD.md b/BUILD.md
index e98d204d0b..895e14d54d 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -1,6 +1,6 @@
-| :warning: **WARNING** :warning: |
-| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| These instructions assume you have a C++ development environment ready with Git, Python, Conan, CMake, and a C++ compiler. For help setting one up on Linux, macOS, or Windows, [see this guide](./docs/build/environment.md).
These instructions also assume a basic familiarity with Conan and CMake. If you are unfamiliar with Conan, you can read our [crash course](./docs/build/conan.md) or the official [Getting Started][conan-getting-started] walkthrough. |
+| :warning: **WARNING** :warning: |
+| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| These instructions assume you have a C++ development environment ready with Git, Python, Conan, CMake, Rust, and a C++ compiler. For help setting one up on Linux, macOS, or Windows, [see this guide](./docs/build/environment.md).
These instructions also assume a basic familiarity with Conan and CMake. If you are unfamiliar with Conan, you can read our [crash course](./docs/build/conan.md) or the official [Getting Started][conan-getting-started] walkthrough. |
## Minimum Requirements
@@ -226,6 +226,22 @@ cmake --build build/codegen --target code_gen
The regenerated files should be committed alongside your changes. CI verifies
that they are up-to-date.
+## Rust crates
+
+The build compiles the Rust workspace in `crates/` and generates the cxxbridge
+bindings the C++ side includes, so it needs a Rust toolchain (`cargo`, `rustc`)
+at the channel pinned in [`rust-toolchain.toml`](./rust-toolchain.toml). The
+[Nix development shell](./docs/build/nix.md) provides one; otherwise install it
+as described in [Rust](./docs/build/environment.md#rust).
+
+The crates also have their own Rust unit tests. Those are run with `cargo` and
+need only the Rust toolchain, independently of CMake (CI runs them with
+`cargo nextest`):
+
+```bash
+cargo test --manifest-path crates/Cargo.toml --workspace
+```
+
## Coverage report
The coverage report is intended for developers using compilers GCC
@@ -304,7 +320,6 @@ See [Sanitizers docs](./docs/build/sanitizers.md) for more details.
| ---------------- | ------------- | ----------------------------------------------------------------------------- |
| `assert` | OFF | Force enabling assertions. |
| `coverage` | OFF | Prepare the coverage report. |
-| `rust` | OFF | Build the Rust crates and the C++ code that depends on them. |
| `tests` | OFF | Build tests. |
| `unity` | OFF | Configure a unity build. |
| `verify_headers` | ON | Make the `verify-headers` target available to compile each header on its own. |
@@ -317,30 +332,6 @@ memory) since they concatenate sources into fewer translation units. Non-unity
builds may be faster for incremental builds, and can be helpful for detecting
`#include` omissions.
-### Rust crates
-
-The Rust crates in `crates/` are only part of the build when `rust` is ON. With
-`-Drust=OFF` (the default) the `crates` directory is not added to the build, no
-cxxbridge bindings are generated, and the C++ tests that exercise the Rust
-interop are not compiled — so no Rust toolchain is needed. CI builds always pass
-`-Drust=ON`.
-
-With `-Drust=ON` you need one extra dependency: a Rust toolchain (`cargo`,
-`rustc`) matching the channel pinned in
-[`rust-toolchain.toml`](./rust-toolchain.toml), which compiles the crates and
-generates the cxxbridge bindings. It is provided by the
-[Nix development shell](./docs/build/nix.md), so `-Drust=ON` works there without
-any extra setup; otherwise install it as described in
-[Rust](./docs/build/environment.md#rust).
-
-The crates also have their own Rust unit tests. Those are run with `cargo` and
-need only the Rust toolchain, independently of CMake and of the `rust` option
-(CI runs them with `cargo nextest`):
-
-```bash
-cargo test --manifest-path crates/Cargo.toml --workspace
-```
-
### Verifying headers
The regular build only compiles `.cpp` files, so a header is only ever checked
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 35309a9824..de2aff5325 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -321,7 +321,7 @@ See the [environment setup guide](./docs/build/environment.md#clang-tidy) for ho
### Running clang-tidy locally
-Before running clang-tidy, you must generate the files it depends on (protobuf headers, and, when the project is configured with `-Drust=ON`, the cxxbridge headers from the Rust crates). Configure the project as described in [`BUILD.md`](./BUILD.md), then build the `tidy_prerequisites` target, which generates all of them:
+Before running clang-tidy, you must generate the files it depends on (protobuf headers and the cxxbridge headers from the Rust crates). Configure the project as described in [`BUILD.md`](./BUILD.md), then build the `tidy_prerequisites` target, which generates all of them:
```bash
cmake --build build --target tidy_prerequisites
diff --git a/cmake/XrplSettings.cmake b/cmake/XrplSettings.cmake
index 58b902baa1..be9bf1fda2 100644
--- a/cmake/XrplSettings.cmake
+++ b/cmake/XrplSettings.cmake
@@ -32,11 +32,6 @@ endif()
option(benchmark "Build benchmarks" ON)
-# When OFF, the crates directory is not added to the build at all: no Rust
-# toolchain is required, no cxxbridge bindings are generated, and the C++ tests
-# that consume those bindings are left out of the build tree.
-option(rust "Build the Rust crates and the C++ code that depends on them" OFF)
-
# Enabled by default so every header is compiled on its own as the main file of
# its own compile_commands.json entry - this is what lets clang-tidy (and clangd
# and IDEs) analyse a header's own includes directly. The per-header objects are
diff --git a/conanfile.py b/conanfile.py
index 0683a3779f..ae677b99aa 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -152,8 +152,12 @@ class Xrpl(ConanFile):
"CMakeLists.txt",
"cfg/*",
"cmake/*",
+ "crates/*",
+ "crates/.cargo/*",
+ "!crates/target/*",
"external/*",
"include/*",
+ "rust-toolchain.toml",
"src/*",
)
diff --git a/docs/build/environment.md b/docs/build/environment.md
index 51580b12a5..f5853321db 100644
--- a/docs/build/environment.md
+++ b/docs/build/environment.md
@@ -1,5 +1,5 @@
Our [build instructions][BUILD.md] assume you have a C++ development
-environment complete with Git, Python, Conan, CMake, and a C++ compiler.
+environment complete with Git, Python, Conan, CMake, Rust, and a C++ compiler.
This document explains how to set one up.
[BUILD.md]: ../../BUILD.md
@@ -36,19 +36,17 @@ compiler building. Treat support for anything outside the table as best-effort.
Besides a compiler, building `xrpld` requires:
-| Tool | Minimum version |
-| ------------------------------------------- | --------------- |
-| [Git](https://git-scm.com/downloads) | any recent |
-| [Python](https://www.python.org/downloads/) | 3.11 |
-| [Conan](https://conan.io/downloads.html) | 2.17 |
-| [CMake](https://cmake.org/download/) | 3.16 |
+| Tool | Minimum version |
+| ------------------------------------------- | ------------------------ |
+| [Git](https://git-scm.com/downloads) | any recent |
+| [Python](https://www.python.org/downloads/) | 3.11 |
+| [Conan](https://conan.io/downloads.html) | 2.17 |
+| [CMake](https://cmake.org/download/) | 3.16 |
+| [Rust](https://rustup.rs) | 1.95 (see [Rust](#rust)) |
On Linux and macOS, the [Nix development shell](./nix.md) provides all of them
(see below). On Windows they have to be installed manually.
-Building with `-Drust=ON` additionally requires a Rust toolchain, see
-[Rust](#rust). A default build does not, so it is not in the table above.
-
Once they are in place, verify that everything is installed and runnable with:
```bash
@@ -122,18 +120,14 @@ manually:
"x64 Native Tools Command Prompt". CI configures CMake with the
`Visual Studio 18 2026` generator.
- [Git for Windows](https://git-scm.com/download/win)
-- Python, Conan, and CMake, at the versions listed in
+- Python, Conan, CMake, and Rust, at the versions listed in
[Required tools](#required-tools).
-- a [Rust toolchain](https://rustup.rs) — only needed to build with
- `-Drust=ON`, see [Rust](#rust)
## Rust
The repository contains a Rust workspace in [`crates/`](../../crates), whose
-crates are exposed to C++ through [cxx](https://cxx.rs) bindings. It is **not**
-part of a default build: the CMake `rust` option is OFF by default, and with it
-off no Rust toolchain is needed. It is only required when configuring with
-`-Drust=ON` (which is what CI does), see [Options](../../BUILD.md#options).
+crates are exposed to C++ through [cxx](https://cxx.rs) bindings and compiled by
+the CMake build, so a Rust toolchain is required.
The toolchain (`cargo`, `rustc`) is pinned to the channel in
[`rust-toolchain.toml`](../../rust-toolchain.toml) at the repository root. If
diff --git a/docs/build/nix.md b/docs/build/nix.md
index 0b701b39f3..9a49416657 100644
--- a/docs/build/nix.md
+++ b/docs/build/nix.md
@@ -128,9 +128,8 @@ Coverage builds (`-Dcoverage=ON`) work in the `gcc` shell (and `gcc-plain` on Li
each ships a `gcov` matching its compiler, since Nix's cc-wrapper does not expose one.
The `clang` shells do not include `llvm-cov`, so use a `gcc` shell for coverage.
-Builds of the Rust crates (`-Drust=ON`) also work out of the box: every shell
-provides the Rust toolchain pinned in
-[`rust-toolchain.toml`](../../rust-toolchain.toml) (see
+The Rust toolchain the build needs is included too: every shell provides the
+channel pinned in [`rust-toolchain.toml`](../../rust-toolchain.toml) (see
[Rust](./environment.md#rust)), plus the `cargo-audit`, `cargo-llvm-cov` and
`cargo-nextest` plugins.
diff --git a/src/tests/libxrpl/CMakeLists.txt b/src/tests/libxrpl/CMakeLists.txt
index 650b295177..e2285ff672 100644
--- a/src/tests/libxrpl/CMakeLists.txt
+++ b/src/tests/libxrpl/CMakeLists.txt
@@ -26,6 +26,7 @@ target_link_libraries(xrpl_tests PRIVATE GTest::gtest GTest::gmock xrpl.libxrpl)
# Lets the wasm tests write their modules as WebAssembly text. Test-only by construction:
# the assembler lives in a crate nothing in libxrpl or xrpld links (see crates/CMakeLists).
target_link_libraries(xrpl_tests PRIVATE xrpl_wasm_testkit_cxxbridge)
+target_link_libraries(xrpl_tests PRIVATE rs_hello_world_cxxbridge)
add_dependencies(xrpl_tests xrpl_crates)
# One source subdirectory per module. Network unit tests are currently not
@@ -48,9 +49,6 @@ set(test_modules
if(NOT WIN32)
list(APPEND test_modules net)
endif()
-if(rust)
- target_link_libraries(xrpl_tests PRIVATE rs_hello_world_cxxbridge)
-endif()
foreach(module IN LISTS test_modules)
# Append the module's sources (${module}/*.cpp and ${module}.cpp, if any).
@@ -60,12 +58,6 @@ foreach(module IN LISTS test_modules)
"${CMAKE_CURRENT_SOURCE_DIR}/${module}/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/${module}.cpp"
)
- if(NOT rust)
- # Tests of the Rust interop include generated cxxbridge headers, which
- # do not exist without the crates, so keep them out of the build tree
- # entirely. They are named `Rust.cpp`.
- list(FILTER sources EXCLUDE REGEX "/Rust[^/]*\\.cpp$")
- endif()
target_sources(xrpl_tests PRIVATE ${sources})
# Expose the module's private headers under their canonical include path.