Code snippets without `main` pass tests but fail to compile in the slide

Aperta
#3,155 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 17 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
rust

Direzione di ricerca

Inizia con il codice sorgente della slide collegata su PartialEq ed Eq ed esegui mdbook test per riprodurre il motivo per cui lo snippet passa nonostante l’assenza di main. Confronta il comportamento del test con il modo in cui gli snippet di codice vengono compilati ed eseguiti nella slide, quindi rendi coerente la gestione in modo da eliminare questa discrepanza e verificarla tramite test.

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

Descrizione

The "PartialEq and Eq" slide in the idiomatic course has a code snippet that doesn't compile or run, but is not marked ignore or compile_fail, and mdbook test does not fail.

The issue is that the code snippet is missing a main function, and so fails to compile/run when trying to run it in the slide. But when running tests, it looks like a main function wrapper is implicitly added if the snippet doesn't have its own main. This means that the tests pass, even though the code doesn't work when trying to teach the class.

I think the implicit main behavior is useful and can allow us to write more concise code examples, but we either need to add that behavior when running the code snippets in the slide, or we need to remove this behavior from the tests so that tests can catch when code snippets don't work.

Lingua principale
Rust
Stelle
33.5k
Fork
2.1k
Merge medio
16g 20h
PR unite (30g)
1

Preparare l'ambiente

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 google/comprehensive-rust

Tutte le issue di google/comprehensive-rust

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.