Make method time on trait impl explitit to help bindings generator 2021-09-type-explicit-bounds
authorMatt Corallo <git@bluematt.me>
Thu, 23 Sep 2021 04:02:58 +0000 (04:02 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 23 Sep 2021 04:02:58 +0000 (04:02 +0000)
Associated types in C bindings is somewhat of a misnomer - we
concretize each trait to a single struct. Thus, different trait
implementations must still have the same type, which defeats the
point of associated types.

In this particular case, however, we can reasonably special-case
the `Infallible` type, as an instance of it existing implies
something has gone horribly wrong.

In order to help our bindings code figure out how to do so when
referencing a parent trait's associated type, we specify the
explicit type in the implementation method signature.

lightning/src/ln/peer_handler.rs

index 68751f30ef11b2b83d507fd4f84c5343405288d8..1815d4a350cc0289100d207b9fa2a98029397b1d 100644 (file)
@@ -101,7 +101,7 @@ impl wire::CustomMessageReader for IgnoringMessageHandler {
 }
 
 impl CustomMessageHandler for IgnoringMessageHandler {
-       fn handle_custom_message(&self, _msg: Self::CustomMessage, _sender_node_id: &PublicKey) -> Result<(), LightningError> {
+       fn handle_custom_message(&self, _msg: Infallible, _sender_node_id: &PublicKey) -> Result<(), LightningError> {
                // Since we always return `None` in the read the handle method should never be called.
                unreachable!();
        }