Comment indentation creates failing doctests

Aperta
#3,530 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start by reproducing the failure with the Rust doc attribute shown in the issue and the documented .clang_arg options. Read the bindgen code that handles C comments and generates Rust documentation to find where indentation becomes a failing doctest. Done means the generated documentation no longer creates a failing doctest for the example; the issue leaves the implementation approach open.

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

Descrizione

cargo test fails if the code for which bindings are generated inadvertently contains indented markdown code blocks.

For instance, if this is generated in a library:

#[doc = "This fails\n\n      to compile"]

a doctest is created that fails to compile.

Could this be avoided somehow? For instance, could I disable interpreting C comments as markdown when using

.clang_arg("-fretain-comments-from-system-headers")
.clang_arg("-fparse-all-comments")

E.g. using raw string

#[doc = r#"This does not fail\n\n      to compile"#]

does not seem to create a doctest.

Lingua principale
Rust
Stelle
5.3k
Fork
846
Merge medio
2g 6h
PR unite (30g)
11

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 rust-lang/rust-bindgen

Tutte le issue di rust-lang/rust-bindgen

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.