FuelLabs/fuels-rs · warning · anyhow::Error
Anchor unused: {unused_anchor:?}!
Error message
Anchor unused: {unused_anchor:?}! What it means
Doc-checking warning (scripts/check-docs): a valid ANCHOR/ANCHOR_END pair exists in the source tree but no markdown include references it. It is returned in the warnings vector, not the errors vector, so it flags dead anchors rather than failing the include resolution itself.
Source
Thrown at scripts/check-docs/src/lib.rs:55
anchor.file == include.anchor_file && anchor.name == include.anchor_name
});
match maybe_anchor.take() {
Some(anchor) => Ok(anchor.clone()),
None => Err(anyhow!(
"No anchor available to satisfy include {include:?}"
)),
}
})
.partition_result();
let additional_warnings = valid_anchors
.iter()
.filter(|valid_anchor| {
let anchor_used_in_a_pair = pairs.iter().any(|anchor| anchor == *valid_anchor);
!anchor_used_in_a_pair
})
.map(|unused_anchor| anyhow!("Anchor unused: {unused_anchor:?}!"))
.collect::<Vec<_>>();
(errors, additional_warnings)
}
#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct Include {
pub anchor_name: String,
pub anchor_file: PathBuf,
pub include_file: PathBuf,
pub line_no: usize,
}
pub fn parse_includes(text_w_includes: String) -> (Vec<Include>, Vec<Error>) {
let apply_regex = |regex: Regex| {
let (includes, errors): (Vec<_>, Vec<_>) = text_w_includes
.lines()View on GitHub (pinned to d9a250a518)
Solutions
- Decide whether the anchor should still be documented: if yes, add a {{#include file:anchor}} snippet in the appropriate markdown page.
- If the anchor is obsolete, delete the ANCHOR:/ANCHOR_END: marker pair from the source file.
- If the warning is expected and acceptable locally, note that it is a warning not an error — but treat CI config as authoritative for whether warnings fail the job.
Example fix
// examples/cookbook/src/lib.rs (before)
// ANCHOR: unused_snippet
fn helper() {}
// ANCHOR_END: unused_snippet
// after: either remove the markers, or reference it in docs/src/page.md
// {{#include ../../../examples/cookbook/src/lib.rs:unused_snippet}} Defensive patterns
Strategy: validation
Validate before calling
// before flagging in review: grep for includes referencing each anchor // shell: grep -rn "#include.*:anchor_name" docs/src
Prevention
- Delete ANCHOR markers in the same commit that removes the doc snippet referencing them.
- Periodically run check-docs and treat the unused-anchor warning list as a cleanup backlog.
- Name anchors after the example they wrap so stale ones are obvious.
When it happens
Trigger: After pairing all includes, any valid_anchor not present in the pairs list produces this warning — e.g. an include referencing the anchor was deleted from the docs, or a new ANCHOR block was added in example code without a corresponding {{#include ...}} in markdown.
Common situations: Docs reorganization removes a markdown page that used the anchor; example code gains ANCHOR markers 'for later'; the include's anchor_name was changed to point at a different anchor, orphaning the previous one.
Related errors
- No anchor available to satisfy include {include:?}
- Couldn't find a matching end anchor for {start:?}
- The end of the anchor appears before the beginning. End anch
- {the_path:?} when canonicalized gives error {err:?}\ninclude
- file `{}` not in SUMMARY.md
AI-assisted analysis of FuelLabs/fuels-rs@d9a250a518 (2026-08-16).
Data as JSON: /api/errors/da9da66347fda28e.
Report an issue: GitHub.