• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rust-bitcoin / rust-bitcoin / 10462962133
83%

Build:
DEFAULT BRANCH: master
Ran 20 Aug 2024 12:19AM UTC
Jobs 1
Files 98
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Aug 2024 12:18AM UTC coverage: 82.841% (-0.001%) from 82.842%
10462962133

push

github

apoelstra
Merge rust-bitcoin/rust-bitcoin#3182: Refactor Rust version checking

ad34a98c6 Refactor Rust version checking (Martin Habovstiak)
7d5ce89da Fix type ambiguity in IO tests (Martin Habovstiak)

Pull request description:

  Conditional compilation depending on Rust version using `cfg` had the disadvantage that we had to write the same code multiple times, compile it multiple times, execute it multiple times, update it multiple times... Apart from obvious maintenance issues the build script wasn't generating the list of allowed `cfg`s so those had to be maintained manually in `Cargo.toml`. This was fixable by printing an appropriate line but it's best to do it together with the other changes.

  Because we cannot export `cfg` flags from a crate to different crates we take a completely different approach: we define a macro called `rust_version` that takes a very naturally looking condition such as `if >= 1.70 {}`. This macro is auto-generated so that it produces different results based on the compiler version - it either expands to first block or the second block (after `else`).

  This way, the other crates can simply call the macro when needed.

  Unfortunately some minimal maintenance is still needed: to update the max version number when a newer version is used. (Note that code will still work with higher versions, it only limits which conditions can be used in downstream code.) This can be automated with the pin update script or we could just put the pin file into the `internals` directory and read the value from there. Not automating isn't terrible either since anyone adding a cfg with higher version will see a nice error about unknown version of Rust and can update it manually.

  Because this changes syntax to a more naturally looking version number, as a side effect the `cond_const` macro could be also updated to use the new macro under the hood, providing much nicer experience - it is... (continued)

2 of 2 new or added lines in 2 files covered. (100.0%)

19650 of 23720 relevant lines covered (82.84%)

15629.44 hits per line

Jobs
ID Job ID Ran Files Coverage
1 10462962133.1 20 Aug 2024 12:19AM UTC 0
82.84
GitHub Action Run
Source Files on build 10462962133
Detailed source file information is not available for this build.
  • Back to Repo
  • Github Actions Build #10462962133
  • 95a78058 on github
  • Prev Build on master (#10453582531)
  • Next Build on master (#10475541682)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc