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

rust-bitcoin / rust-bitcoin / 13733762849
83%

Build:
DEFAULT BRANCH: master
Ran 08 Mar 2025 03:59AM UTC
Jobs 1
Files 126
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

08 Mar 2025 03:58AM UTC coverage: 83.04% (+0.04%) from 83.002%
13733762849

push

github

apoelstra
Merge rust-bitcoin/rust-bitcoin#4182: Replace uses of `chunks_exact` with `as_chunks`

<a class=hub.com/rust-bitcoin/rust-bitcoin/commit/<a class="double-link" href="https://git"><a class=hub.com/rust-bitcoin/rust-bitcoin/commit/a01370052715b6733f07011f28944105493bda63">a01370052 Replace uses of `chunks_exact` with `as_chunks` (Martin Habovstiak)

Pull request description:

  This is now ready for review.

  In the past we've been using `chunks_exact` because const generics were unstable but then, when they were stabilized we didn't use `as_chunks` (or `array_chunks`) since they were unstable. But the instability was only because Rust devs don't know how to handle `0` being passed in. The function is perfectly implementable on stable. (With a tiny, easy-to-understand `unsafe` block.) `core` doesn't want to make a decision for all other crates yet but we can make it for our own crates because we know that we simply never pass zero. (And even if we did, we could just change the decision.)

  It also turns out there's a hack to simulate `const {}` block in our MSRV, so we can make compilation fail early.

  This commit adds an extension trait to internals to provide the methods, so we no longer have to use `chunks_exact`. It also cleans up the code quite nicely.

  Previous unresolved question, leaving for reference:

  > One issue with this change is that the names collide which could lead to hard error in future Rust versions. How do we solve it?
  > * ignore and just backport the fix once that actually happens
  > * rename the methods to something reasonable (e.g. `as_array_chunks`) - this risks that they'll rename the methods to the same thing by accident and it'll break anyway
  > * rename the methods to something silly (`bitcoin_as_chunks`) - yeah, the risk above is not there but then we have silly-looking code.

  We've decide to just rename the methods to something that won't possibly collide.

ACKs for top commit:
  tcharding:
    ACK a01370052715b6733f07011f28944105493bda63
  apoelstra:
    ACK a01370052715b6733f07011f28944105493bda63; successfully ran local tests; nice!

Tree-SHA512: cc3359518... (continued)

81 of 83 new or added lines in 10 files covered. (97.59%)

2 existing lines in 2 files now uncovered.

21631 of 26049 relevant lines covered (83.04%)

16984.26 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
49.26
0.0% hashes/src/sha256/crypto.rs

Coverage Regressions

Lines Coverage ∆ File
1
56.72
-1.25% bitcoin/src/taproot/merkle_branch.rs
1
49.26
0.0% hashes/src/sha256/crypto.rs
Jobs
ID Job ID Ran Files Coverage
1 13733762849.1 08 Mar 2025 03:59AM UTC 126
83.04
GitHub Action Run
Source Files on build 13733762849
  • Tree
  • List 126
  • Changed 10
  • Source Changed 10
  • Coverage Changed 10
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #13733762849
  • f7b1810b on github
  • Prev Build on master (#13732459809)
  • Next Build on master (#13734239804)
  • 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