[bindings] Drop manual implementations of Features conversion
authorMatt Corallo <git@bluematt.me>
Thu, 11 Feb 2021 17:57:14 +0000 (12:57 -0500)
committerMatt Corallo <git@bluematt.me>
Thu, 18 Feb 2021 17:28:25 +0000 (12:28 -0500)
We now handle features properly in our own resolution, and these
appear to be self-inconsistent in some cases.

c-bindings-gen/src/types.rs

index 656ec13f96c53ef8c4cce6ef62e5bb7cdca2c611..8c15b1258dad3ee6b80b105f626d571f0b84e024 100644 (file)
@@ -666,10 +666,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        // Override the default since Records contain an fmt with a lifetime:
                        "util::logger::Record" => Some("*const std::os::raw::c_char"),
 
-                       // List of structs we map that aren't detected:
-                       "ln::features::InitFeatures" if is_ref && ptr_for_ref => Some("crate::ln::features::InitFeatures"),
-                       "ln::features::InitFeatures" if is_ref => Some("*const crate::ln::features::InitFeatures"),
-                       "ln::features::InitFeatures" => Some("crate::ln::features::InitFeatures"),
                        _ => None,
                }
        }
@@ -729,9 +725,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        "ln::channelmanager::PaymentPreimage" if is_ref => Some("&::lightning::ln::channelmanager::PaymentPreimage(unsafe { *"),
                        "ln::channelmanager::PaymentSecret" => Some("::lightning::ln::channelmanager::PaymentSecret("),
 
-                       // List of structs we map (possibly during processing of other files):
-                       "ln::features::InitFeatures" if !is_ref => Some("*unsafe { Box::from_raw("),
-
                        // List of traits we map (possibly during processing of other files):
                        "crate::util::logger::Logger" => Some(""),
 
@@ -784,10 +777,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        "ln::channelmanager::PaymentPreimage" if is_ref => Some(" })"),
                        "ln::channelmanager::PaymentSecret" => Some(".data)"),
 
-                       // List of structs we map (possibly during processing of other files):
-                       "ln::features::InitFeatures" if is_ref => Some(".inner) }"),
-                       "ln::features::InitFeatures" if !is_ref => Some(".take_inner()) }"),
-
                        // List of traits we map (possibly during processing of other files):
                        "crate::util::logger::Logger" => Some(""),
 
@@ -868,11 +857,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        // Override the default since Records contain an fmt with a lifetime:
                        "util::logger::Record" => Some("local_"),
 
-                       // List of structs we map (possibly during processing of other files):
-                       "ln::features::InitFeatures" if is_ref && ptr_for_ref => Some("crate::ln::features::InitFeatures { inner: &mut "),
-                       "ln::features::InitFeatures" if is_ref => Some("Box::into_raw(Box::new(crate::ln::features::InitFeatures { inner: &mut "),
-                       "ln::features::InitFeatures" if !is_ref => Some("crate::ln::features::InitFeatures { inner: Box::into_raw(Box::new("),
-
                        _ => None,
                }.map(|s| s.to_owned())
        }
@@ -930,11 +914,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        // Override the default since Records contain an fmt with a lifetime:
                        "util::logger::Record" => Some(".as_ptr()"),
 
-                       // List of structs we map (possibly during processing of other files):
-                       "ln::features::InitFeatures" if is_ref && ptr_for_ref => Some(", is_owned: false }"),
-                       "ln::features::InitFeatures" if is_ref => Some(", is_owned: false }))"),
-                       "ln::features::InitFeatures" => Some(")), is_owned: true }"),
-
                        _ => None,
                }.map(|s| s.to_owned())
        }