Skip to content

Commit 4ffd664

Browse files
authored
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.
1 parent 9e9786b commit 4ffd664

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

GEMINI.md

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

0 commit comments

Comments
 (0)