]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Don't make references to `std` in `lightning-invoice` in bindings 2022-09-invoice-bindings-nostd
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:39:14 +0000 (10:39 +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 a1c0db58fa4792a5e340a10f9393b3ae90def96f..ee85fab0b5dbe8081d3b21e367c36125c28ecf92 100644 (file)
@@ -1913,7 +1913,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 5faecbfabd748c1ca9c48cc4d9c9600e803daf59..d7185c999ee4356cd8f755cc2f319c986e3950bc 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> {