{"record":{"id":"7b88ffe2676396dd","repo":"loco-rs/loco","slug":"found-no-rust-blocks-in-rust-dirs-the-extractor-is-broken","errorCode":null,"errorMessage":"found no ```rust blocks in {RUST_DIRS:?} — the extractor is broken, not the docs","messagePattern":"found no ```rust blocks in (.+?) — the extractor is broken, not the docs","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/docs_syntax.rs","lineNumber":76,"sourceCode":"    if !root.is_dir() {\n        bail!(\"{} does not exist\", root.display());\n    }\n\n    let mut blocks = Vec::new();\n    collect(&root, &mut blocks)?;\n    if blocks.is_empty() {\n        bail!(\n            \"found no ```rust blocks under {} — the extractor is broken, not the docs\",\n            root.display()\n        );\n    }\n\n    let before_sources = blocks.len();\n    for dir in RUST_DIRS {\n        collect(&project_dir.join(dir), &mut blocks)?;\n    }\n    if blocks.len() == before_sources {\n        bail!(\"found no ```rust blocks in {RUST_DIRS:?} — the extractor is broken, not the docs\");\n    }\n\n    let mut failures = Vec::new();\n    let mut checked = 0;\n    let mut skipped = 0;\n\n    for block in &blocks {\n        if block.skipped {\n            skipped += 1;\n            continue;\n        }\n        checked += 1;\n        if let Err(error) = parse(&block.code) {\n            failures.push(format!(\n                \"{}:{}: not valid Rust — {error}\\n    (if this is deliberate, write the fence as ```rust {SKIP_MARKER}=\\\"why\\\")\",\n                block.file.display(),\n                block.line,\n            ));","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/loco-rs/loco/blob/23639d1e360dbc618073642b507d6f8664adbaff/xtask/src/docs_syntax.rs#L58-L94","documentation":"Companion check to the docs check: after collecting ```rust blocks from the docs tree, the tool scans the source directories listed in `RUST_DIRS` and bails if it found no *new* blocks there. This catches the extractor silently failing on source trees, again blamed on the extractor rather than the code.","triggerScenarios":"Running the checker when none of the files in `RUST_DIRS` yield ```rust blocks — e.g. a misconfigured `RUST_DIRS` constant, renamed source directories, or a broken fence parser.","commonSituations":"After renaming src directories without updating `RUST_DIRS`; after refactoring `collect()`; running against a checkout where source files were stripped.","solutions":["Verify the `RUST_DIRS` constant lists existing directories relative to the project root","Test the fence-matching logic in `collect` against a known doc-commented file","Restore or fix the source directories referenced by `RUST_DIRS`"],"exampleFix":"// before\nconst RUST_DIRS: &[&str] = &[\"crates/loco-rs/src\"];\n// after\nconst RUST_DIRS: &[&str] = &[\"src\", \"loco-gen/src\", \"loco-new/src\"];","handlingStrategy":"validation","validationCode":"assert!(RUST_DIRS.iter().all(|d| Path::new(d).is_dir()), \"RUST_DIRS entries missing\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the RUST_DIRS constant in sync when renaming source directories","Unit-test collect() on a fixture file with known fenced blocks"],"tags":["docs","tooling","markdown","configuration"],"backgroundTag":"empty-result-set","analyzedSha":"23639d1e360dbc618073642b507d6f8664adbaff","analyzedAt":"2026-09-12T01:47:20.769Z","contentChangedAt":"2026-09-12T01:47:20.769Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}