loco-rs/loco · error
found no ```rust blocks in
Error message
found no ```rust blocks in {RUST_DIRS:?} — the extractor is broken, not the docs What it means
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.
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`
Example fix
// before const RUST_DIRS: &[&str] = &["crates/loco-rs/src"]; // after const RUST_DIRS: &[&str] = &["src", "loco-gen/src", "loco-new/src"];
Defensive patterns
Strategy: validation
Validate before calling
assert!(RUST_DIRS.iter().all(|d| Path::new(d).is_dir()), "RUST_DIRS entries missing");
Prevention
- Keep the RUST_DIRS constant in sync when renaming source directories
- Unit-test collect() on a fixture file with known fenced blocks
When it happens
Trigger: 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.
Common situations: After renaming src directories without updating `RUST_DIRS`; after refactoring `collect()`; running against a checkout where source files were stripped.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- found no ```rust blocks under
- : : ` ` needs a reason — write it as ```rust ="why this is…
- does not exist
- : : ```rust block is never closed
AI-assisted analysis of loco-rs/loco@23639d1e36 (2026-09-12).
Data as JSON: /api/errors/7b88ffe2676396dd.
Report an issue: GitHub.
Appendix: source
Thrown at xtask/src/docs_syntax.rs:76
if !root.is_dir() {
bail!("{} does not exist", root.display());
}
let mut blocks = Vec::new();
collect(&root, &mut blocks)?;
if blocks.is_empty() {
bail!(
"found no ```rust blocks under {} — the extractor is broken, not the docs",
root.display()
);
}
let before_sources = blocks.len();
for dir in RUST_DIRS {
collect(&project_dir.join(dir), &mut blocks)?;
}
if blocks.len() == before_sources {
bail!("found no ```rust blocks in {RUST_DIRS:?} — the extractor is broken, not the docs");
}
let mut failures = Vec::new();
let mut checked = 0;
let mut skipped = 0;
for block in &blocks {
if block.skipped {
skipped += 1;
continue;
}
checked += 1;
if let Err(error) = parse(&block.code) {
failures.push(format!(
"{}:{}: not valid Rust — {error}\n (if this is deliberate, write the fence as ```rust {SKIP_MARKER}=\"why\")",
block.file.display(),
block.line,
));View on GitHub (pinned to 23639d1e36)