From: Matt Corallo Date: Sun, 25 Sep 2022 14:24:13 +0000 (+0000) Subject: Don't make references to `std` in `lightning-invoice` in bindings X-Git-Tag: v0.0.112~25^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=refs%2Fheads%2F2022-09-invoice-bindings-nostd;p=rust-lightning Don't make references to `std` in `lightning-invoice` in bindings 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. --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be52e0577..49b857c39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/lightning-invoice/src/payment.rs b/lightning-invoice/src/payment.rs index a1c0db58f..ee85fab0b 100644 --- a/lightning-invoice/src/payment.rs +++ b/lightning-invoice/src/payment.rs @@ -1913,7 +1913,7 @@ mod tests { #[cfg(c_bindings)] impl lightning::util::ser::Writeable for TestScorer { - fn write(&self, _: &mut W) -> Result<(), std::io::Error> { unreachable!(); } + fn write(&self, _: &mut W) -> Result<(), lightning::io::Error> { unreachable!(); } } impl Score for TestScorer { diff --git a/lightning-invoice/src/utils.rs b/lightning-invoice/src/utils.rs index 5faecbfab..d7185c999 100644 --- a/lightning-invoice/src/utils.rs +++ b/lightning-invoice/src/utils.rs @@ -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(&self, writer: &mut W) -> Result<(), std::io::Error> { self.scorer.write(writer) } + fn write(&self, writer: &mut W) -> Result<(), lightning::io::Error> { self.scorer.write(writer) } } impl<'a, S: Score> Score for ScorerAccountingForInFlightHtlcs<'a, S> {