Skip to content

Fix CI and pin nightly so it shouldn't break again #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/cron-weekly-update-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Update Nightly rustc
on:
schedule:
- cron: "5 0 * * 6" # Saturday at 00:05
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update nightly rustc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Update rust.yml to use latest nightly
run: |
set -x
# Not every night has a nightly, so extract the date from whatever
# version of the compiler dtolnay/rust-toolchain gives us.
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
# Update the nightly version in the reference file.
echo "nightly-${NIGHTLY_DATE}" > nightly-version
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
# Some days there is no new nightly. In this case don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated nightly. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.APOELSTRA_RUST_BITCOIN_ORG_CREATE_PR }}
author: Update Nightly Rustc Bot <bot@example.com>
committer: Update Nightly Rustc Bot <bot@example.com>
title: Automated update to nightly-version (to nightly-${{ env.nightly_date }})
body: |
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
branch: create-pull-request/weekly-nightly-update
8 changes: 4 additions & 4 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ jobs:

fuzz:
if: ${{ !github.event.act }}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
fuzz_target: [berlekamp_massey, correct_bech32, correct_codex32, decode_rnd, encode_decode, parse_hrp]
steps:
- name: Install test dependencies
run: sudo apt-get update -y && sudo apt-get install -y binutils-dev libunwind8-dev libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc libiberty-dev
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache-fuzz
with:
path: |
Expand All @@ -38,7 +38,7 @@ jobs:
needs: fuzz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
Expand Down
40 changes: 29 additions & 11 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ on: [push, pull_request]
name: Continuous Integration

jobs:
Prepare:
runs-on: ubuntu-latest
outputs:
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Read nightly version"
id: read_toolchain
run: echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT

Stable:
name: Test - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout Toolchain
# https://github.com/dtolnay/rust-toolchain
uses: dtolnay/rust-toolchain@stable
Expand All @@ -28,7 +39,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@beta
- name: Running test script
Expand All @@ -38,14 +49,17 @@ jobs:

Nightly:
name: Test - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@nightly
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: Running test script
env:
DO_DOCSRS: true
Expand All @@ -60,7 +74,7 @@ jobs:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@1.56.1
- name: Running test script
Expand All @@ -70,18 +84,20 @@ jobs:

EmbeddedWithAlloc:
name: no_std with alloc
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@nightly
uses: dtolnay/rust-toolchain@v1
with:
targets: thumbv7m-none-eabi
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: Run
env:
RUSTFLAGS: "-C link-arg=-Tlink.x"
Expand All @@ -90,18 +106,20 @@ jobs:

EmbeddedNoAlloc:
name: no_std no alloc
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@nightly
uses: dtolnay/rust-toolchain@v1
with:
targets: thumbv7m-none-eabi
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: Run
env:
RUSTFLAGS: "-C link-arg=-Tlink.x"
Expand All @@ -113,7 +131,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Add architecture i386
Expand All @@ -131,7 +149,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install target
Expand Down
1 change: 1 addition & 0 deletions nightly-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly-2025-07-11
2 changes: 1 addition & 1 deletion src/primitives/correction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl<Ck: Checksum> Corrector<Ck> {
///
/// If the input string has sufficiently many errors, this unique closest correct
/// string may not actually be the intended string.
pub fn bch_errors(&self) -> Option<ErrorIterator<Ck>> {
pub fn bch_errors(&self) -> Option<ErrorIterator<'_, Ck>> {
// 1. Compute all syndromes by evaluating the residue at each power of the generator.
let syndromes: Polynomial<_> = Ck::ROOT_GENERATOR
.powers_range(Ck::ROOT_EXPONENTS)
Expand Down
6 changes: 3 additions & 3 deletions src/primitives/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ impl<'s> CheckedHrpstring<'s> {
///
/// Converts the ASCII bytes representing field elements to the respective field elements.
#[inline]
pub fn fe32_iter(&self, _: u8) -> AsciiToFe32Iter {
pub fn fe32_iter(&self, _: u8) -> AsciiToFe32Iter<'_> {
AsciiToFe32Iter { iter: self.ascii.iter().copied() }
}

Expand All @@ -453,7 +453,7 @@ impl<'s> CheckedHrpstring<'s> {
/// Converts the ASCII bytes representing field elements to the respective field elements, then
/// converts the stream of field elements to a stream of bytes.
#[inline]
pub fn byte_iter(&self) -> ByteIter {
pub fn byte_iter(&self) -> ByteIter<'_> {
ByteIter { iter: AsciiToFe32Iter { iter: self.ascii.iter().copied() }.fes_to_bytes() }
}

Expand Down Expand Up @@ -663,7 +663,7 @@ impl<'s> SegwitHrpstring<'s> {
///
/// Use `self.witness_version()` to get the witness version.
#[inline]
pub fn byte_iter(&self) -> ByteIter {
pub fn byte_iter(&self) -> ByteIter<'_> {
ByteIter { iter: AsciiToFe32Iter { iter: self.ascii.iter().copied() }.fes_to_bytes() }
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/primitives/fieldvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<F> FieldVec<F> {
/// # Panics
///
/// Panics if [`Self::has_data`] is false.
pub fn iter(&self) -> slice::Iter<F> {
pub fn iter(&self) -> slice::Iter<'_, F> {
if self.len > NO_ALLOC_MAX_LENGTH {
self.assert_has_data();
#[cfg(feature = "alloc")]
Expand All @@ -143,7 +143,7 @@ impl<F> FieldVec<F> {
/// # Panics
///
/// Panics if [`Self::has_data`] is false.
pub fn iter_mut(&mut self) -> slice::IterMut<F> {
pub fn iter_mut(&mut self) -> slice::IterMut<'_, F> {
if self.len > NO_ALLOC_MAX_LENGTH {
self.assert_has_data();
#[cfg(feature = "alloc")]
Expand Down
8 changes: 4 additions & 4 deletions src/primitives/hrp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,24 +237,24 @@ impl Hrp {
/// If an uppercase HRP was parsed during object construction then this iterator will yield
/// uppercase ASCII `char`s. For lowercase bytes see [`Self::lowercase_byte_iter`]
#[inline]
pub fn byte_iter(&self) -> ByteIter { ByteIter { iter: self.buf[..self.size].iter() } }
pub fn byte_iter(&self) -> ByteIter<'_> { ByteIter { iter: self.buf[..self.size].iter() } }

/// Creates a character iterator over the ASCII characters of this HRP.
///
/// If an uppercase HRP was parsed during object construction then this iterator will yield
/// uppercase ASCII `char`s. For lowercase bytes see [`Self::lowercase_char_iter`].
#[inline]
pub fn char_iter(&self) -> CharIter { CharIter { iter: self.byte_iter() } }
pub fn char_iter(&self) -> CharIter<'_> { CharIter { iter: self.byte_iter() } }

/// Creates a lowercase iterator over the byte values (ASCII characters) of this HRP.
#[inline]
pub fn lowercase_byte_iter(&self) -> LowercaseByteIter {
pub fn lowercase_byte_iter(&self) -> LowercaseByteIter<'_> {
LowercaseByteIter { iter: self.byte_iter() }
}

/// Creates a lowercase character iterator over the ASCII characters of this HRP.
#[inline]
pub fn lowercase_char_iter(&self) -> LowercaseCharIter {
pub fn lowercase_char_iter(&self) -> LowercaseCharIter<'_> {
LowercaseCharIter { iter: self.lowercase_byte_iter() }
}

Expand Down
4 changes: 3 additions & 1 deletion src/primitives/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ pub trait Fe32IterExt: Sized + Iterator<Item = Fe32> {

/// Adapts the Fe32 iterator to encode the field elements into a bech32 address.
#[inline]
fn with_checksum<Ck: Checksum>(self, hrp: &Hrp) -> Encoder<Self, Ck> { Encoder::new(self, hrp) }
fn with_checksum<Ck: Checksum>(self, hrp: &Hrp) -> Encoder<'_, Self, Ck> {
Encoder::new(self, hrp)
}
}

impl<I> Fe32IterExt for I where I: Iterator<Item = Fe32> {}
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/polynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<F: Field> Polynomial<F> {
/// # Panics
///
/// Panics if [`Self::has_data`] is false.
pub fn iter(&self) -> slice::Iter<F> {
pub fn iter(&self) -> slice::Iter<'_, F> {
self.assert_has_data();
self.coefficients().iter()
}
Expand Down