commit | c51aeb1f0efe5a161dad589ff3060708a88b89fa | [log] [tgz] |
---|---|---|
author | Lukasz Anforowicz <lukasza@google.com> | Mon Nov 07 10:56:18 2022 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Mon Nov 07 10:56:55 2022 -0800 |
tree | 28ec3184c723c91b6f43d0b32f4db97dd739a5b6 | |
parent | 60292f4293e00f1d4b4e5566c5f601d19114f51e [diff] |
Explicit names for anonymous parameters: `fn foo(_: f64, _: f64)`. In theory, the names could be omitted in *some* C++ translations (e.g. `void foo(double, double)`), but they are required in other scenarios: 1. Forwarding an argument to a Rust function with a different name (e.g. `#[export_name = ...]` attribute and/or Rust-ABI functions). `return ::__crubit_internal::export_name(need_param_name_here)`. 2. Irrefutable, destructuring pattern matching - e.g.: `fn foo((x, y): (i32, i32)) {}` (this CL doesn't yet provide test coverage for this scenario, because types that support destructuring are not yet supported). PiperOrigin-RevId: 486708734
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