Elffuss BraidHub

utopia-ia/elffuss-braid public

CI: pin the toolchain, use as_chunks, fuzz on the gnu target

The first public CI run failed in two ways:
- The newest stable clippy has a lint (chunks_exact_to_as_chunks) that
  older ones did not. The fixed-size chunk loops now use as_chunks,
  stable since Rust 1.88, so the minimum version stays 1.89. CI pins
  the toolchain from now on, so that a new release never breaks the
  build by surprise; it is bumped on purpose.
- The prebuilt cargo-fuzz picks the musl target, which has no sanitizer
  support here. The fuzz job names the gnu target.
Changeset7b35ddcb3f64cb55714e81d45b6fc77a54ef207cacf268b0c660a5b76c554cb7
AuthorKikoCis <KikoCis@users.noreply.github.com> · 2026-10-16 17:00 +02:00
CommitterKikoCis <KikoCis@users.noreply.github.com> · 2026-10-16 17:00 +02:00
Parents2a0e4dd55cbb

Browse the files at this changeset

6 files changed

modified .github/workflows/ci.yml +7 −5
@@ -12,6 +12,8 @@
1212 CARGO_TERM_COLOR: always
1313 RUSTFLAGS: -D warnings
1414
15+# The toolchain is pinned so that a new stable release, with new lints,
16+# never breaks the build by surprise: bump it on purpose.
1517 jobs:
1618 test:
1719 name: test (${{ matrix.os }})
@@ -26,7 +28,7 @@
2628 # The git bridge round-trips this repository's own history, which a
2729 # shallow checkout does not have.
2830 fetch-depth: 0
29- - uses: dtolnay/rust-toolchain@stable
31+ - uses: dtolnay/rust-toolchain@1.99.0
3032 with:
3133 components: rustfmt, clippy
3234 - uses: Swatinem/rust-cache@v2
@@ -48,7 +50,7 @@
4850 runs-on: ubuntu-latest
4951 steps:
5052 - uses: actions/checkout@v5
51- - uses: dtolnay/rust-toolchain@stable
53+ - uses: dtolnay/rust-toolchain@1.99.0
5254 with:
5355 targets: wasm32-unknown-unknown
5456 - run: cargo check -p elffuss-braid-format -p elffuss-braid-engine --target wasm32-unknown-unknown --locked
@@ -68,7 +70,7 @@
6870 with:
6971 # The quick import scenario reads this repository's own history.
7072 fetch-depth: 0
71- - uses: dtolnay/rust-toolchain@stable
73+ - uses: dtolnay/rust-toolchain@1.99.0
7274 - uses: Swatinem/rust-cache@v2
7375 # Small inputs, only to keep the suite working: the ratios of a quick
7476 # run mean nothing, and its results stay on the runner, unpublished.
@@ -88,7 +90,7 @@
8890 runs-on: ubuntu-latest
8991 steps:
9092 - uses: actions/checkout@v5
91- - uses: dtolnay/rust-toolchain@stable
93+ - uses: dtolnay/rust-toolchain@1.99.0
9294 - uses: Swatinem/rust-cache@v2
9395 - run: cargo install b3sum --locked
9496 - run: python3 docs/spec/check_vectors.py
@@ -106,5 +108,5 @@
106108 working-directory: fuzz
107109 run: |
108110 for target in decode_tree decode_changeset names git_map git_objects; do
109- cargo fuzz run "$target" -- -max_total_time=60
111+ cargo fuzz run --target x86_64-unknown-linux-gnu "$target" -- -max_total_time=60
110112 done
modified crates/format/src/id.rs +4 −3
@@ -189,9 +189,10 @@
189189 return Err(ParseIdError::Length(digits.len()));
190190 }
191191 let mut bytes = [0u8; 32];
192- for (i, pair) in digits.chunks_exact(2).enumerate() {
193- let high = hex_value(pair[0]).ok_or(ParseIdError::Digit(2 * i))?;
194- let low = hex_value(pair[1]).ok_or(ParseIdError::Digit(2 * i + 1))?;
192+ let (pairs, _) = digits.as_chunks::<2>();
193+ for (i, [high, low]) in pairs.iter().enumerate() {
194+ let high = hex_value(*high).ok_or(ParseIdError::Digit(2 * i))?;
195+ let low = hex_value(*low).ok_or(ParseIdError::Digit(2 * i + 1))?;
195196 bytes[i] = (high << 4) | low;
196197 }
197198 Ok(Self(bytes))
modified crates/git/src/oid.rs +1 −1
@@ -129,7 +129,7 @@
129129 return None;
130130 }
131131 let mut bytes = [0u8; 20];
132- for (byte, pair) in bytes.iter_mut().zip(digits.chunks_exact(2)) {
132+ for (byte, pair) in bytes.iter_mut().zip(digits.as_chunks::<2>().0) {
133133 *byte = (hex_value(pair[0])? << 4) | hex_value(pair[1])?;
134134 }
135135 Some(Self(bytes))
modified crates/store/src/derived.rs +1 −1
@@ -143,7 +143,7 @@
143143 }
144144 let bytes = read_range(file, state.read_to, end - state.read_to)
145145 .map_err(io_error("read", &self.path))?;
146- for slot in bytes.chunks_exact(ENTRY_LEN as usize) {
146+ for slot in bytes.as_chunks::<{ ENTRY_LEN as usize }>().0 {
147147 if let Some((key, id)) = decode(slot) {
148148 state.map.insert(key, id);
149149 }
modified crates/store/src/index.rs +8 −6
@@ -201,7 +201,7 @@
201201 }
202202 let (table, fanout) = checked.split_at(COVERED_LEN * segments);
203203 let mut covered = Vec::with_capacity(segments);
204- for slot in table.chunks_exact(COVERED_LEN) {
204+ for slot in table.as_chunks::<COVERED_LEN>().0 {
205205 let name = hex(&slot[..16]);
206206 if covered.iter().any(|seen: &Covered| seen.name == name) {
207207 return Err(Damaged("index names a segment twice"));
@@ -212,8 +212,10 @@
212212 });
213213 }
214214 let fanout: Vec<u32> = fanout
215- .chunks_exact(4)
216- .map(|value| u32::from_le_bytes(array(value)))
215+ .as_chunks::<4>()
216+ .0
217+ .iter()
218+ .map(|value| u32::from_le_bytes(*value))
217219 .collect();
218220 if fanout.windows(2).any(|pair| pair[0] > pair[1]) || u64::from(fanout[255]) != count {
219221 return Err(Damaged(
@@ -235,7 +237,7 @@
235237 return Err(IndexError::Damaged("index bucket cut short"));
236238 }
237239 let mut entries: Vec<(Entry, u16)> = Vec::with_capacity(bytes.len() / ENTRY_LEN as usize);
238- for slot in bytes.chunks_exact(ENTRY_LEN as usize) {
240+ for slot in bytes.as_chunks::<{ ENTRY_LEN as usize }>().0 {
239241 let (entry, segment) = Entry::decode_in(slot).map_err(|unusable| match unusable {
240242 Unusable::Invalid => IndexError::Damaged("index entry fails its checksum"),
241243 Unusable::Newer => {
@@ -409,7 +411,7 @@
409411 }
410412
411413 let mut below = 0usize;
412- for (byte, value) in fanout.chunks_exact(4).enumerate() {
414+ for (byte, value) in fanout.as_chunks::<4>().0.iter().enumerate() {
413415 below += entries[below..]
414416 .iter()
415417 .take_while(|entry| usize::from(entry.id.as_bytes()[0]) == byte)
@@ -440,7 +442,7 @@
440442 _ => b - b'a' + 10,
441443 };
442444 let mut out = [0u8; 16];
443- for (slot, pair) in out.iter_mut().zip(name.as_bytes().chunks_exact(2)) {
445+ for (slot, pair) in out.iter_mut().zip(name.as_bytes().as_chunks::<2>().0) {
444446 *slot = digit(pair[0]) << 4 | digit(pair[1]);
445447 }
446448 out
modified crates/store/tests/versions.rs +2 −2
@@ -297,10 +297,10 @@
297297 out.extend_from_slice(&(count as u64).to_le_bytes());
298298 out.extend_from_slice(segment_len);
299299 out.extend_from_slice(fanout);
300- for entry in entries.chunks_exact(64) {
300+ for entry in entries.as_chunks::<64>().0 {
301301 out.extend_from_slice(&entry[..32]);
302302 }
303- for entry in entries.chunks_exact(64) {
303+ for entry in entries.as_chunks::<64>().0 {
304304 out.extend_from_slice(&entry[32..60]);
305305 out.extend_from_slice(&0u32.to_le_bytes());
306306 }