Don't make references to `std` in `lightning-invoice` in bindings 2022-09-invoice-bindings-nostd-111
authorMatt Corallo <git@bluematt.me>
Sun, 25 Sep 2022 14:24:13 +0000 (14:24 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 26 Sep 2022 10:38:49 +0000 (10:38 +0000)
As we support `no-std` for `lightning-invoice` builds, we should
support them in `c_bindings` as well, which we add a test for in
CI here.

.github/workflows/build.yml
lightning-invoice/src/payment.rs
lightning-invoice/src/utils.rs

index be52e05776cec547342fdae0eedf4777eb41bfd2..49b857c39fd93d1f09c1bf8c35df75f1591c2a57 100644 (file)
@@ -127,6 +127,8 @@ jobs:
           cargo test --verbose --color always --no-default-features --features no-std
           # check if there is a conflict between no-std and the default std feature
           cargo test --verbose --color always --features no-std
+          # check if there is a conflict between no-std and the c_bindings cfg
+          RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
           # check no-std compatibility across dependencies
           cd ..
           cd no-std-check
index e75bb327074bc7cfe63f3c75d699f3629884131e..2ca0fb4cd11a5eda8eff106214f00c39b37bd9a8 100644 (file)
@@ -1912,7 +1912,7 @@ mod tests {
 
        #[cfg(c_bindings)]
        impl lightning::util::ser::Writeable for TestScorer {
-               fn write<W: lightning::util::ser::Writer>(&self, _: &mut W) -> Result<(), std::io::Error> { unreachable!(); }
+               fn write<W: lightning::util::ser::Writer>(&self, _: &mut W) -> Result<(), lightning::io::Error> { unreachable!(); }
        }
 
        impl Score for TestScorer {
index 623fdb8991134fd8941efe9a6b7a997133f9560a..df64ebce6e211ec42beb0384b95f32f06104c09f 100644 (file)
@@ -559,7 +559,7 @@ impl<'a, S: Score> ScorerAccountingForInFlightHtlcs<'a, S> {
 
 #[cfg(c_bindings)]
 impl<'a, S:Score> lightning::util::ser::Writeable for ScorerAccountingForInFlightHtlcs<'a, S> {
-       fn write<W: lightning::util::ser::Writer>(&self, writer: &mut W) -> Result<(), std::io::Error> { self.scorer.write(writer) }
+       fn write<W: lightning::util::ser::Writer>(&self, writer: &mut W) -> Result<(), lightning::io::Error> { self.scorer.write(writer) }
 }
 
 impl<'a, S: Score> Score for ScorerAccountingForInFlightHtlcs<'a, S> {