Remove blanket `CtorNew<(x,)>` impl, in favor of manual impls.

The problem: for each T, if `X : CtorNew<T>`, then `X : CtorNew<(T,)>`, then `X : CtorNew<((T,),)>`, then...

This causes infinite overflow on failure to match:

```
error[E0275]: overflow evaluating the requirement `_: Sized`
  --> third_party/crubit/rs_bindings_from_cc/test/cc_std/test.rs:15:22
   |
15 |             let _t = tm::ctor_new(());
   |                      ^^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`main`)
   = note: required because of the requirements on the impl of `CtorNew<(_,)>` for `cc_std::tm`
   = note: 128 redundant requirements hidden
   = note: required because of the requirements on the impl of `CtorNew<(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((_,),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),)>` for `cc_std::tm`
```

However, if we have exactly two impls -- for `T` and `(T,)` (but not `((T,),)` etc.), then the same error becomes:

```
error[E0277]: the trait bound `cc_std::tm: CtorNew<_>` is not satisfied
  --> third_party/crubit/rs_bindings_from_cc/test/cc_std/test.rs:15:22
   |
15 |             let _t = tm::ctor_new(());
   |                      ^^^^^^^^^^^^ the trait `CtorNew<_>` is not implemented for `cc_std::tm`
```

Much, much clearer.

Unfortunately, the only way to do this that I know of is to manually implement the `T` and `(T,)` variants. We can't automatically implement `(T,)` via blanket impl, because that will also implement `((T,),)`, etc.  And we can't start with `(T,)` and automatically implement for `T`, because this produces the same infinite recursion errors even faster (https://play.rust-lang.org/?gist=87e3bbdbe8ea6ac0e2d16f4d3a9a37b2).

So yeah, the solution would seem to be manual impls. Although exactly how to do them is up in the air -- this CL just pastes in a short snippet as an extra item. I'm not super happy with it, but there's no easy way to do it in a more structured way for now.

P.S. I swore I already had implemented this. I can't find it in my CL history, so I must have thrown it away... oops!

PiperOrigin-RevId: 446146280
6 files changed
tree: d3e9abb5d09746f314a73fb6c3274ae1fb41733d
  1. cc_template/
  2. common/
  3. docs/
  4. lifetime_annotations/
  5. migrator/
  6. rs_bindings_from_cc/
  7. BUILD
  8. CODE_OF_CONDUCT
  9. CONTRIBUTING
  10. LICENSE
  11. README.md
README.md

Crubit: C++/Rust Bidirectional Interop Tool

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.