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-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=a126a4e44a6bff4d037a340b6b6079528abab730;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 be52e057..49b857c3 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 e75bb327..2ca0fb4c 100644 --- a/lightning-invoice/src/payment.rs +++ b/lightning-invoice/src/payment.rs @@ -1912,7 +1912,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 623fdb89..df64ebce 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> {