Make `salsa_utils::SalsaResult` (now `arc_anyhow::Result`) the common result type.

I've renamed the module to `arc_anyhow`, since it is not actually salsa-specific: any attempt to cache errors would run into the same problems. (That is, we'ds till need to define this, even if we weren't using Salsa, purely because we wish to cache the return values!)

---

Making `arc_anyhow::Result` the common result type gets rid of cruft when writing code, where we have a separate impl / wrapper for Salsa.separate query function / body stuff.

It also gets rid of error nesting -- for the most part, `arc_anyhow::Result` won't convert into `anyhow::Result` except when adding `context`. That is actually kinda often, but whatever. :)

(The reason we want to avoid these conversions is -- well, if anyhow is Box, and arc_anyhow is Arc, how do you convert an `Arc<dyn T>` into a `Box<dyn T>`? By having a `Box<Arc<dyn T>>`. Oof!)

I tried to do less than this CL, but most of my attempts to be less invasive and get similar problems at the interop boundary. The easiest way to avoid anyhow/salsa interop problems is to stop directly using anyhow.

We may want to _truly_ stop using anyhow in order to avoid expensive round-trip conversions. At the moment it's not really buying us a lot.

PiperOrigin-RevId: 460483713
11 files changed
tree: 15896476a7706de40d270b18b7709f3e9ac0cb74
  1. .bazelci/
  2. bazel/
  3. cc_template/
  4. common/
  5. docs/
  6. lifetime_analysis/
  7. lifetime_annotations/
  8. migrator/
  9. nullability_verification/
  10. rs_bindings_from_cc/
  11. .bazelrc
  12. .gitignore
  13. BUILD
  14. Cargo.Bazel.lock
  15. CODE_OF_CONDUCT
  16. CONTRIBUTING
  17. LICENSE
  18. README.md
  19. WORKSPACE
README.md

Crubit: C++/Rust Bidirectional Interop Tool

Build status

Extremely experimental interop tooling for C++ and Rust.

Please don‘t use, this is an experiment and we don’t yet know where will it take us. There will be breaking changes without warning. Unfortunately, we can't take contributions at this point.

Building Crubit

$ apt install clang lld bazel
$ git clone git@github.com:google/crubit.git
$ cd crubit
$ bazel build --linkopt=-fuse-ld=/usr/bin/ld.lld //rs_bindings_from_cc:rs_bindings_from_cc_impl

Using a prebuilt LLVM tree

$ git clone https://github.com/llvm/llvm-project
$ cd llvm-project
$ CC=clang CXX=clang++ cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS='clang' -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install
$ cmake --build build -j
$ # wait...
$ cmake --install build
$ cd ../crubit
$ LLVM_INSTALL_PATH=../llvm-project/install bazel build //rs_bindings_from_cc:rs_bindings_from_cc_impl