Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#96 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
73/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Inizia da crates/hv2-net/src/nat.rs, in internet_checksum, dove data.chunks_exact(2) attiva il lint segnalato. Controlla la toolchain stabile attuale con cargo clippy -p hv2-net --all-targets -- -D warnings, quindi rendi portabile la gestione del lint tra le versioni stabili. Il lavoro è completato quando il comando riesce sulle toolchain in cui il lint esiste e su quelle in cui non esiste.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
103
Fork
3
Merge medio
9h 56m
PR unite (30g)
137

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nervosys/HyperMachine

Tutte le issue di nervosys/HyperMachine

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.