1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-10-09 10:55:26 +02:00

docs(gemini): Explain mdbook's isolated snippet compilation (#2918)

Add a new "Technical Context: mdbook" section to GEMINI.md.

This section clarifies two key behaviors of mdbook that are essential
for accurate code analysis and review:

- Rust code snippets are compiled in isolation.

- Annotations like 'compile_fail' describe the expected test outcome.

This information is added to prevent incorrect assumptions about shared
scope between code blocks, ensuring more accurate analysis in the
future.
This commit is contained in:
Dmitri Gribenko
2025-09-22 10:34:48 +02:00
committed by GitHub
parent 9e9786bafd
commit 4ffd664f47

View File

@@ -154,3 +154,21 @@ list of options.
`/// # Safety` is used to document safety preconditions for `unsafe` code.
- **Comments:** HTML comments (`<!-- ... -->`) are used for editor/translator
instructions and content control (e.g., `mdbook-xgettext: skip`).
# Project-Specific Technical Context
This section contains critical, non-obvious technical details about this
project's tooling and environment that an AI assistant needs to know to perform
its tasks correctly.
## `mdbook` Behavior
- **Isolated Code Snippets:** `mdbook` treats each fenced Rust code block (e.g.,
`` ```rust ... ``` ``) as a separate compilation unit. When analyzing a code
snippet, treat it as a self-contained program. Do not assume it shares a scope
or context with other snippets in the same file unless the surrounding text
explicitly states otherwise.
- **Interpreting Annotations:** Annotations like `compile_fail`, `should_panic`,
and `editable` describe how a snippet is tested. For example, `compile_fail`
means the snippet is expected to fail compilation, which is useful for
demonstrating common errors.