From: Matt Corallo Date: Thu, 23 Sep 2021 04:02:58 +0000 (+0000) Subject: Make method time on trait impl explitit to help bindings generator X-Git-Tag: v0.0.101~2^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=ab49e4101fdc77a074a4db9fe2ff10acad7d1cc2;p=rust-lightning 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. --- diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 68751f30e..1815d4a35 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!(); }