From ab49e4101fdc77a074a4db9fe2ff10acad7d1cc2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 23 Sep 2021 04:02:58 +0000 Subject: [PATCH] Make method time on trait impl explitit to help bindings generator 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 68751f30..1815d4a3 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -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!(); } -- 2.30.2