{"record":{"id":"a56586f884def875","repo":"rust-lang/cargo","slug":"the-lints-documentation-is-out-of-date-run-cargo","errorCode":null,"errorMessage":"The lints documentation is out-of-date. Run `cargo lint-docs` to update it.","messagePattern":"The lints documentation is out-of-date\\. Run `cargo lint-docs` to update it\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/xtask-lint-docs/src/main.rs","lineNumber":89,"sourceCode":"    if !warn.is_empty() {\n        add_level_section(LintLevel::Warn, &warn, &mut buf)?;\n    }\n    if !deny.is_empty() {\n        add_level_section(LintLevel::Deny, &deny, &mut buf)?;\n    }\n    if !forbid.is_empty() {\n        add_level_section(LintLevel::Forbid, &forbid, &mut buf)?;\n    }\n\n    buf.push_str(&lint_docs);\n\n    writeln!(buf)?;\n    writeln!(buf, \"[`package.rust-version`]: rust-version.md\")?;\n\n    if check {\n        let old = std::fs::read_to_string(lint_docs_path())?;\n        if old != buf {\n            anyhow::bail!(\n                \"The lints documentation is out-of-date. Run `cargo lint-docs` to update it.\"\n            );\n        }\n    } else {\n        std::fs::write(lint_docs_path(), buf)?;\n    }\n    Ok(())\n}\n\nfn lint_groups(buf: &mut String) -> anyhow::Result<()> {\n    writeln!(\n        buf,\n        r#\"## Lint groups\n\nCargo has the concept of a \"lint group\",\nwhere you can toggle several warnings through one name.\"#\n    )?;\n    let (max_name_len, max_desc_len) = cargo::diagnostics::LINT_GROUPS","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/rust-lang/cargo/blob/42eee92bc9aa4449f4e25d84e4ceb1cf8e0f87f9/crates/xtask-lint-docs/src/main.rs#L71-L107","documentation":"xtask-lint-docs regenerates the lints documentation from Cargo's lint definitions. In --check mode it compares the freshly generated content against the on-disk file; if they differ (docs are stale), it bails instructing the user to run `cargo lint-docs` to regenerate. This keeps docs in sync with lint definitions.","triggerScenarios":"Running `cargo lint-docs --check` after lint definitions/levels changed but before regenerating the docs file. The generated buffer differs from the committed file, so the check fails.","commonSituations":"Editing lint registrations or levels in source without updating the docs; CI lint-docs check on a PR that touches lints; rebasing across a lint change.","solutions":["Run `cargo lint-docs` (without --check) to regenerate, then commit the updated file.","If the diff is unexpected, inspect the changed lint definitions to ensure the regeneration is correct."],"exampleFix":"// before\ncargo lint-docs --check   # fails\n// after\ncargo lint-docs           # regenerate\ngit add src/doc/src/reference/lints.md\ngit commit -m \"doc: update lints\"","handlingStrategy":"validation","validationCode":"// Run generation then compare to keep docs in sync\nlet _ = Command::new(\"cargo\").arg(\"lint-docs\").status()?;\n// commit if changed; the --check variant then passes","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Regenerate lint docs in the same PR that changes lint definitions.","Run `cargo lint-docs --check` in CI to catch drift."],"tags":["cargo","xtask","docs","lint","ci"],"backgroundTag":null,"analyzedSha":"42eee92bc9aa4449f4e25d84e4ceb1cf8e0f87f9","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}