[bindings] Use resolved, not local ident in generic mangling
authorMatt Corallo <git@bluematt.me>
Sat, 6 Feb 2021 04:26:53 +0000 (23:26 -0500)
committerMatt Corallo <git@bluematt.me>
Thu, 11 Feb 2021 17:58:42 +0000 (12:58 -0500)
commitb73b85b66ae904691fbff98c963e67f27e1af1e7
tree8510a1765de18d5eead3acb848af20644368d420
parent1ef05855f7894c1849da483e9338311da60d80f4
[bindings] Use resolved, not local ident in generic mangling

In traits with associated types which are returned in generics (ie
`trait T { type A: B; fn c() -> Result<Self::A, ()> {} }`), we
created a new generic mapping with the local type name (in this
case A) instead of using the real type (in this case B). This is
confusing as it results in generic manglings that don't reference
the real type (eg `LDKCResult_ChanKeySignerDecodeErrorZ`) and
may have multiple generic definitions that are identical.

Instead, we now use the final ident in the resolved mapping. The
biggest win is `LDKCResult_ChanKeySignerDecodeErrorZ` changing to
`CResult_ChannelKeysDecodeErrorZ`. However, there are several types
where `secp256k1::Error` was imported as `SecpError` and types like
`LDKCResult_SecretKeySecpErrorZ` are now
`LDKCResult_SecretKeyErrorZ` instead. Still, the type of the error
field remains `LDKSecp256k1Error`, which should avoid any confusion.
c-bindings-gen/src/types.rs