commit | f36762abecde31a0b2f6c74d43897d7a224c701a | [log] [tgz] |
---|---|---|
author | Lukasz Anforowicz <lukasza@google.com> | Thu Mar 02 18:43:07 2023 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Mar 02 18:43:47 2023 -0800 |
tree | 223c31f6e5ffe1dda9508830f28efc8cae165b73 | |
parent | 843d1617b6a822b507fc92430cc96a8ebc220505 [diff] |
Fix panics when `pub fn` depends on `pub` reimport from private `mod`. Before this CL, `cc_bindings_from_rs` would panic with an error message like: '`Dependency::predecessor` should refer to a NodeId in the `nodes` parameter. predecessor = SnippetKey { def_id: DefId(0:553 ~ emath[b789]::vec2::Vec2), kind: MainApi }; successor = SnippetKey { def_id: DefId(0:43 ~ emath[b789]::align::center_size_in_rect), kind: ImplDetails }', .../cc_bindings_from_rs/toposort.rs:142:32. The problem was that `format_adt_core` would succeed for types in private modules, even though `cc_bindings_from_rs` doesn't currently support reimports. This would result in emitting bindings for functions that refer to non-existent bindings for parameter types. PiperOrigin-RevId: 513697609
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