Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

hv2-net::nat: clippy is red again on current stable (chunks_exact_to_as_chunks)

オープン 初心者向け
#96 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
73/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

crates/hv2-net/src/nat.rs の internet_checksum から始めます。ここでは data.chunks_exact(2) が報告された lint を発生させます。cargo clippy -p hv2-net --all-targets -- -D warnings で現在の stable toolchain を確認し、lint の処理を stable バージョン間で移植可能にします。lint が存在する toolchain と存在しない toolchain の両方で、このコマンドが成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Verifying #95's networking work (all four pieces: device, attach_net, guest driver, bridge) against current stable before treating it as done. Good news first, since it's the more important result:

The full chain works end to end

Ran the net_echo example against /dev/kvm (via WSL) -- the thing the handoff page flagged as "not run": a guest booted, its virtio-net driver came up, and a frame round-tripped through it.

guest         : /tmp/hv2-unikernel/hv2-unikernel.elf
net           : window at 0xd0020000, IRQ 6
guest driver  : up in    7.4 ms
frame sent    : 57 bytes
echo          : 57 bytes back, addresses swapped
round trip    :    2.3 ms
result        : a frame crossed into a guest, through a driver with no allocator under it, and came back

Also independently reran and counted the unit tests the recent commits claim: 9 on virtio_net_mmio, 9 on VM::attach_net, 5 on hv2_net::bridge -- 23, matching. cargo fmt --all -- --check is clean.

But clippy is red on hv2-net right now

cargo clippy -p hv2-net --all-targets -- -D warnings (same command CI runs, per 11997dd's message) fails today:

error: using `chunks_exact` with a constant chunk size
   --> crates\hv2-net\src\nat.rs:418:27
418 |     let mut chunks = data.chunks_exact(2);
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`

This is the same lint 11997dd removed the #[allow(...)] for, on the grounds that the attribute was itself unknown (unknown_lints) on the toolchain that session had. rust-toolchain.toml pins channel = "stable" -- a floating channel, not a fixed version -- so which lints exist under -D warnings depends on whenever rustup last updated. My local stable right now is 1.98.1 and it does recognize clippy::chunks_exact_to_as_chunks; whatever stable 11997dd's session had did not. Both sessions ran the identical command in good faith and got opposite answers, which is what a floating channel does.

The portable fix -- survives both directions of that drift -- is #[allow(unknown_lints, clippy::chunks_exact_to_as_chunks)] rather than the lint alone: unknown_lints swallows the "this isn't a real lint" complaint on an older toolchain, and the specific allow swallows the real one on a newer toolchain that has it.

#[allow(unknown_lints, clippy::chunks_exact_to_as_chunks)] // may not exist on every `stable`; unknown_lints covers that case too
fn internet_checksum(data: &[u8]) -> u16 {

Worth deciding separately, and out of scope for this issue: whether channel = "stable" should become a pinned version instead, so cargo clippy -D warnings gives the same verdict on every machine and in CI rather than depending on when each one last ran rustup update. This is the second time this exact class of drift has cost a red build over this one function.

主要言語
Rust
スター
103
フォーク
3
平均マージ
9時間 56分
マージ済み PR(30日)
137

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nervosys/HyperMachine のほかの issue

nervosys/HyperMachine の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。