Skip to content

Commit 5f2c320

Browse files
committed
Merge #223: Fix CI and pin nightly so it shouldn't break again
7a3f493 ci: update checkout and cache to v4; runner to ubuntu-latest. (Andrew Poelstra) 62a9d53 add weekly cronjob to update nightly-version (Andrew Poelstra) 4c00b93 introduce nightly-version file (copied from rust-bitcoin) and use it in CI (Andrew Poelstra) 720992b clippy: fix new lifetime lint (Andrew Poelstra (aider)) Pull request description: Right now I can't test #220 or #221 locally because clippy is failing with the latest nightly. I can disable the local clippy check but I'd prefer to fix it here. Should unblock both those PRs. ACKs for top commit: clarkmoody: ACK 7a3f493 Tree-SHA512: 725177b18bce543c6c114ce0ee6ef04bc6862c440a2fff9b99d607b912f6ab2c0eab22ecf03abc89332519aa9ffc4ddd624d16abfce0c6d4fefad53a87eb5249
2 parents f7d846e + 7a3f493 commit 5f2c320

File tree

10 files changed

+89
-27
lines changed

10 files changed

+89
-27
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Update Nightly rustc
2+
on:
3+
schedule:
4+
- cron: "5 0 * * 6" # Saturday at 00:05
5+
workflow_dispatch: # allows manual triggering
6+
jobs:
7+
format:
8+
name: Update nightly rustc
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: dtolnay/rust-toolchain@nightly
13+
- name: Update rust.yml to use latest nightly
14+
run: |
15+
set -x
16+
# Not every night has a nightly, so extract the date from whatever
17+
# version of the compiler dtolnay/rust-toolchain gives us.
18+
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
19+
# Update the nightly version in the reference file.
20+
echo "nightly-${NIGHTLY_DATE}" > nightly-version
21+
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
22+
# Some days there is no new nightly. In this case don't make an empty PR.
23+
if ! git diff --exit-code > /dev/null; then
24+
echo "Updated nightly. Opening PR."
25+
echo "changes_made=true" >> $GITHUB_ENV
26+
else
27+
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
28+
echo "changes_made=false" >> $GITHUB_ENV
29+
fi
30+
- name: Create Pull Request
31+
if: env.changes_made == 'true'
32+
uses: peter-evans/create-pull-request@v7
33+
with:
34+
token: ${{ secrets.APOELSTRA_RUST_BITCOIN_ORG_CREATE_PR }}
35+
author: Update Nightly Rustc Bot <[email protected]>
36+
committer: Update Nightly Rustc Bot <[email protected]>
37+
title: Automated update to nightly-version (to nightly-${{ env.nightly_date }})
38+
body: |
39+
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
40+
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
41+
branch: create-pull-request/weekly-nightly-update

.github/workflows/fuzz.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ jobs:
66

77
fuzz:
88
if: ${{ !github.event.act }}
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-latest
1010
strategy:
1111
fail-fast: false
1212
matrix:
1313
fuzz_target: [berlekamp_massey, correct_bech32, correct_codex32, decode_rnd, encode_decode, parse_hrp]
1414
steps:
1515
- name: Install test dependencies
1616
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
17-
- uses: actions/checkout@v2
18-
- uses: actions/cache@v2
17+
- uses: actions/checkout@v4
18+
- uses: actions/cache@v4
1919
id: cache-fuzz
2020
with:
2121
path: |
@@ -38,7 +38,7 @@ jobs:
3838
needs: fuzz
3939
runs-on: ubuntu-latest
4040
steps:
41-
- uses: actions/checkout@v2
41+
- uses: actions/checkout@v4
4242
- uses: actions/download-artifact@v4
4343
- name: Display structure of downloaded files
4444
run: ls -R

.github/workflows/rust.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,25 @@ on: [push, pull_request]
33
name: Continuous Integration
44

55
jobs:
6+
Prepare:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
10+
steps:
11+
- name: "Checkout repo"
12+
uses: actions/checkout@v4
13+
- name: "Read nightly version"
14+
id: read_toolchain
15+
run: echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT
16+
617
Stable:
718
name: Test - stable toolchain
819
runs-on: ubuntu-latest
920
strategy:
1021
fail-fast: false
1122
steps:
1223
- name: Checkout Crate
13-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
1425
- name: Checkout Toolchain
1526
# https://github.com/dtolnay/rust-toolchain
1627
uses: dtolnay/rust-toolchain@stable
@@ -28,7 +39,7 @@ jobs:
2839
fail-fast: false
2940
steps:
3041
- name: Checkout Crate
31-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
3243
- name: Checkout Toolchain
3344
uses: dtolnay/rust-toolchain@beta
3445
- name: Running test script
@@ -38,14 +49,17 @@ jobs:
3849

3950
Nightly:
4051
name: Test - nightly toolchain
52+
needs: Prepare
4153
runs-on: ubuntu-latest
4254
strategy:
4355
fail-fast: false
4456
steps:
4557
- name: Checkout Crate
46-
uses: actions/checkout@v3
58+
uses: actions/checkout@v4
4759
- name: Checkout Toolchain
48-
uses: dtolnay/rust-toolchain@nightly
60+
uses: dtolnay/rust-toolchain@v1
61+
with:
62+
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
4963
- name: Running test script
5064
env:
5165
DO_DOCSRS: true
@@ -60,7 +74,7 @@ jobs:
6074
fail-fast: false
6175
steps:
6276
- name: Checkout Crate
63-
uses: actions/checkout@v3
77+
uses: actions/checkout@v4
6478
- name: Checkout Toolchain
6579
uses: dtolnay/[email protected]
6680
- name: Running test script
@@ -70,18 +84,20 @@ jobs:
7084

7185
EmbeddedWithAlloc:
7286
name: no_std with alloc
87+
needs: Prepare
7388
runs-on: ubuntu-latest
7489
strategy:
7590
fail-fast: false
7691
steps:
7792
- name: Checkout Crate
78-
uses: actions/checkout@v3
93+
uses: actions/checkout@v4
7994
- name: Set up QEMU
8095
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
8196
- name: Checkout Toolchain
82-
uses: dtolnay/rust-toolchain@nightly
97+
uses: dtolnay/rust-toolchain@v1
8398
with:
8499
targets: thumbv7m-none-eabi
100+
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
85101
- name: Run
86102
env:
87103
RUSTFLAGS: "-C link-arg=-Tlink.x"
@@ -90,18 +106,20 @@ jobs:
90106

91107
EmbeddedNoAlloc:
92108
name: no_std no alloc
109+
needs: Prepare
93110
runs-on: ubuntu-latest
94111
strategy:
95112
fail-fast: false
96113
steps:
97114
- name: Checkout Crate
98-
uses: actions/checkout@v3
115+
uses: actions/checkout@v4
99116
- name: Set up QEMU
100117
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
101118
- name: Checkout Toolchain
102-
uses: dtolnay/rust-toolchain@nightly
119+
uses: dtolnay/rust-toolchain@v1
103120
with:
104121
targets: thumbv7m-none-eabi
122+
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
105123
- name: Run
106124
env:
107125
RUSTFLAGS: "-C link-arg=-Tlink.x"
@@ -113,7 +131,7 @@ jobs:
113131
runs-on: ubuntu-latest
114132
steps:
115133
- name: Checkout Crate
116-
uses: actions/checkout@v3
134+
uses: actions/checkout@v4
117135
- name: Checkout Toolchain
118136
uses: dtolnay/rust-toolchain@stable
119137
- name: Add architecture i386
@@ -131,7 +149,7 @@ jobs:
131149
runs-on: ubuntu-latest
132150
steps:
133151
- name: Checkout Crate
134-
uses: actions/checkout@v3
152+
uses: actions/checkout@v4
135153
- name: Checkout Toolchain
136154
uses: dtolnay/rust-toolchain@stable
137155
- name: Install target

nightly-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nightly-2025-07-11

src/primitives/correction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<Ck: Checksum> Corrector<Ck> {
175175
///
176176
/// If the input string has sufficiently many errors, this unique closest correct
177177
/// string may not actually be the intended string.
178-
pub fn bch_errors(&self) -> Option<ErrorIterator<Ck>> {
178+
pub fn bch_errors(&self) -> Option<ErrorIterator<'_, Ck>> {
179179
// 1. Compute all syndromes by evaluating the residue at each power of the generator.
180180
let syndromes: Polynomial<_> = Ck::ROOT_GENERATOR
181181
.powers_range(Ck::ROOT_EXPONENTS)

src/primitives/decode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ impl<'s> CheckedHrpstring<'s> {
444444
///
445445
/// Converts the ASCII bytes representing field elements to the respective field elements.
446446
#[inline]
447-
pub fn fe32_iter(&self, _: u8) -> AsciiToFe32Iter {
447+
pub fn fe32_iter(&self, _: u8) -> AsciiToFe32Iter<'_> {
448448
AsciiToFe32Iter { iter: self.ascii.iter().copied() }
449449
}
450450

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

@@ -663,7 +663,7 @@ impl<'s> SegwitHrpstring<'s> {
663663
///
664664
/// Use `self.witness_version()` to get the witness version.
665665
#[inline]
666-
pub fn byte_iter(&self) -> ByteIter {
666+
pub fn byte_iter(&self) -> ByteIter<'_> {
667667
ByteIter { iter: AsciiToFe32Iter { iter: self.ascii.iter().copied() }.fes_to_bytes() }
668668
}
669669
}

src/primitives/fieldvec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<F> FieldVec<F> {
129129
/// # Panics
130130
///
131131
/// Panics if [`Self::has_data`] is false.
132-
pub fn iter(&self) -> slice::Iter<F> {
132+
pub fn iter(&self) -> slice::Iter<'_, F> {
133133
if self.len > NO_ALLOC_MAX_LENGTH {
134134
self.assert_has_data();
135135
#[cfg(feature = "alloc")]
@@ -143,7 +143,7 @@ impl<F> FieldVec<F> {
143143
/// # Panics
144144
///
145145
/// Panics if [`Self::has_data`] is false.
146-
pub fn iter_mut(&mut self) -> slice::IterMut<F> {
146+
pub fn iter_mut(&mut self) -> slice::IterMut<'_, F> {
147147
if self.len > NO_ALLOC_MAX_LENGTH {
148148
self.assert_has_data();
149149
#[cfg(feature = "alloc")]

src/primitives/hrp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,24 @@ impl Hrp {
237237
/// If an uppercase HRP was parsed during object construction then this iterator will yield
238238
/// uppercase ASCII `char`s. For lowercase bytes see [`Self::lowercase_byte_iter`]
239239
#[inline]
240-
pub fn byte_iter(&self) -> ByteIter { ByteIter { iter: self.buf[..self.size].iter() } }
240+
pub fn byte_iter(&self) -> ByteIter<'_> { ByteIter { iter: self.buf[..self.size].iter() } }
241241

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

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

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

src/primitives/iter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ pub trait Fe32IterExt: Sized + Iterator<Item = Fe32> {
8585

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

9193
impl<I> Fe32IterExt for I where I: Iterator<Item = Fe32> {}

src/primitives/polynomial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<F: Field> Polynomial<F> {
7373
/// # Panics
7474
///
7575
/// Panics if [`Self::has_data`] is false.
76-
pub fn iter(&self) -> slice::Iter<F> {
76+
pub fn iter(&self) -> slice::Iter<'_, F> {
7777
self.assert_has_data();
7878
self.coefficients().iter()
7979
}

0 commit comments

Comments
 (0)