]> git.bitcoin.ninja Git - rust-lightning/commitdiff
[bindings] Handle ::-containing paths in generics
authorMatt Corallo <git@bluematt.me>
Mon, 1 Mar 2021 22:08:51 +0000 (17:08 -0500)
committerMatt Corallo <git@bluematt.me>
Sun, 7 Mar 2021 18:06:07 +0000 (13:06 -0500)
Specifically, this is required for some paths which use
`Option<msgs::Message>`.

c-bindings-gen/src/types.rs

index 3e6acaa8d00674139748fa419ef7b4635a6c65f2..ad21b4c6bca53917685979c846021a03cdb45d7e 100644 (file)
@@ -1946,11 +1946,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                                                        if !self.write_c_path_intern(w, &$p_arg.path, generics, true, true, true) { return false; }
                                                                }
                                                        } else {
-                                                               if $p_arg.path.segments.len() == 1 {
-                                                                       write!(w, "{}", $p_arg.path.segments.iter().next().unwrap().ident).unwrap();
-                                                               } else {
-                                                                       return false;
-                                                               }
+                                                               write!(w, "{}", $p_arg.path.segments.last().unwrap().ident).unwrap();
                                                        }
                                                } else if self.is_known_container(&subtype, is_ref) || self.is_transparent_container(&subtype, is_ref) {
                                                        if !self.write_c_mangled_container_path_intern(w, Self::path_to_generic_args(&$p_arg.path), generics,