-
Notifications
You must be signed in to change notification settings - Fork 2k
internal: Define rules for LLMs #21732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| CLAUDE.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| **Reminder: All AI usage must be disclosed in commit messages, see | ||
| CONTRIBUTING.md for more details.** | ||
|
|
||
| ## Build Commands | ||
|
|
||
| ```bash | ||
| cargo build # Build all crates | ||
| cargo test # Run all tests | ||
| cargo test -p <crate> # Run tests for a specific crate (e.g., cargo test -p hir-ty) | ||
| cargo lint # Run clippy on all targets | ||
| cargo xtask codegen # Run code generation | ||
| cargo xtask tidy # Run tidy checks | ||
| UPDATE_EXPECT=1 cargo test # Update test expectations (snapshot tests) | ||
| RUN_SLOW_TESTS=1 cargo test # Run heavy/slow tests | ||
| ``` | ||
|
|
||
| ## Key Architectural Invariants | ||
|
|
||
| - Typing in a function body never invalidates global derived data | ||
| - Parser/syntax tree is built per-file to enable parallel parsing | ||
| - The server is stateless (HTTP-like); context must be re-created from request parameters | ||
| - Cancellation uses salsa's cancellation mechanism; computations panic with a `Cancelled` payload | ||
|
|
||
| ### Code Generation | ||
|
|
||
| Generated code is committed to the repo. Grammar and AST are generated from `ungrammar`. Run `cargo test -p xtask` after adding inline parser tests (`// test test_name` comments). | ||
|
|
||
| ## Testing | ||
|
|
||
| Tests are snapshot-based using `expect-test`. Test fixtures use a mini-language: | ||
| - `$0` marks cursor position | ||
| - `// ^^^^` labels attach to the line above | ||
| - `//- minicore: sized, fn` includes parts of minicore (minimal core library) | ||
| - `//- /path/to/file.rs crate:name deps:dep1,dep2` declares files/crates | ||
|
|
||
| ## Style Notes | ||
|
|
||
| - Use `stdx::never!` and `stdx::always!` instead of `assert!` for recoverable invariants | ||
| - Use `T![fn]` macro instead of `SyntaxKind::FN_KW` | ||
| - Use keyword name mangling over underscore prefixing for identifiers: `crate` → `krate`, `fn` → `func`, `struct` → `strukt`, `type` → `ty` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can likely be improved more (in the future), its not really much stuff