Partial and hacky fix for ElaboratedType-related errors.

This really is my best short right now! I tried being cleverer with how each case handles desugaring, but, for example, one problem I think I am running into is that they generally expect to fully desugar all the way past all sugar nodes, but the nodes we're casting are themselves sugar nodes -- so they skip past both the ElaboratedType and the very node they were meant to match. (Where, before, as a special-case, they matched the node because it wasn't nested inside other sugar.)

(Or in other cases I just seriously don't understand why `getAs`/`getAsAdjusted` don't do what I expect, to be honest. Presumably something like "The Canonical type isn't what I expect"...)

This doesn't fix all tests; I do not currently understand why this happens:

```
thread 'test_incomplete_record_has_rs_name' panicked at 'input unexpectedly didn't match the pattern:
expected '"test_namespace_bindings::MyTemplate<test_namespace_bindings::Param>"'
but got '"test_namespace_bindings::MyTemplate<Param>"'
```

It could be that these are coincidental? There are other differences in the AST: https://godbolt.org/z/WsvKjzG6Y (e.g. `TemplateSpecializationType 'MyTemplate<Type>' sugar MyTemplate` vs `TemplateSpecializationType 'MyTemplate<ns::Type>' sugar MyTemplate`.) I'd need to dig more.

But for now, at least opting for fixing a subset of tests and getting help fixing the rest... My brain tired.

PiperOrigin-RevId: 465531292
3 files changed
tree: 8b6604767a75b80f67f26e0ed670a3a7f712df4f
  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