commit | 3a0cc5a5bec66de6a18be8d0d398459bf0a2ed87 | [log] [tgz] |
---|---|---|
author | Devin Jeanpierre <jeanpierreda@google.com> | Tue Jul 12 09:36:34 2022 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Jul 12 09:37:04 2022 -0700 |
tree | 15896476a7706de40d270b18b7709f3e9ac0cb74 | |
parent | d4742ff0aa11949dbb57a250bb51289ba2093b78 [diff] |
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
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.
$ 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
$ 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