Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
5e53b07
fix: fix syntax bridge panic when spilting float
edragain2nd Jul 18, 2026
f1dc71f
Eagerly normalize `.await`'s `IntoFuture::Output`
ChayimFriedman2 Jul 18, 2026
4af3e05
Merge pull request #22852 from ChayimFriedman2/never-await
Veykril Jul 19, 2026
3e7c36b
Record obligation chain for unimplemented trait diagnostics
Veykril Jul 17, 2026
87f2ae3
Simplify
Veykril Jul 19, 2026
6c7ffa4
Merge pull request #22849 from edragain2nd/illegal_float_spilt
Veykril Jul 19, 2026
cf3dfb9
fix: Fix `InferenceContext:identity_args` using the wrong DefId
Veykril Jul 19, 2026
e82cdd8
Merge pull request #22855 from Veykril/lukaswirth/push-sqpzymzrvzvm
Veykril Jul 19, 2026
aea3da0
Improve AGENTS.md
Veykril Jul 19, 2026
602aff5
Merge pull request #22856 from Veykril/lukaswirth/push-kzkzsunnostv
Veykril Jul 19, 2026
79f049d
fix: Handle enum variants in next-solver `generics`
Veykril Jul 19, 2026
05ca20d
Merge pull request #22857 from Veykril/lukaswirth/push-ttkrrvqrvuqs
Veykril Jul 19, 2026
b5ec4b1
Unleash more lifetimes
Veykril Jun 8, 2026
e7077ff
internal: Pack `ExprOrPatId` when stored
Veykril Jul 19, 2026
4874f31
Record expressions in types in ExprScope
Veykril Jul 19, 2026
9d832f2
Shrink ScopeData by 16 bytes
Veykril Jul 19, 2026
4d0f57e
Support lifetimes in `impl_from` macro
Veykril Jul 19, 2026
cf3070a
Merge pull request #22860 from Veykril/lukaswirth/push-uxlsstlnnszp
Veykril Jul 19, 2026
a9ed9be
Merge pull request #22548 from Veykril/lukaswirth/push-ykqkymxvnkyz
Veykril Jul 19, 2026
82a5471
Merge pull request #22861 from Veykril/lukaswirth/push-ksslunmzoxpt
Veykril Jul 19, 2026
00afadf
internal: Shrink hir::Expr from 64 to 48 bytes
Veykril Jul 19, 2026
079b401
Merge pull request #22862 from Veykril/lukaswirth/push-lstwyoxyymzo
Veykril Jul 19, 2026
a8a8a1c
feat: implement lowering of HRTB
dfireBird May 20, 2026
7f6e92f
fix: Spawn proc-macro servers on requests clearing the client cache
zargovv Jul 19, 2026
28c81c4
Fix formatting
zargovv Jul 19, 2026
125bbca
Merge pull request #22865 from zargovv/master
Veykril Jul 19, 2026
fb9e2e4
feat: merge `WherePredicate::ForLifetimes` into `WherePredicate::Type…
dfireBird Jul 20, 2026
1da5a09
fix `hir-def` crate description
ada4a Jul 20, 2026
e822fe3
Merge pull request #22818 from dfireBird/hrtb-lowering
Veykril Jul 20, 2026
770d9ce
misc improvements
ada4a Jul 9, 2026
2912f66
push `Debug` bound from `HirDatabase` down to `SourceDatabase`
ada4a Jul 14, 2026
f657621
move `#[salsa::tracked]` to the underlying queries
ada4a Jul 15, 2026
9634455
Merge pull request #22866 from ada4a/push-myzupxxuwyvk
ChayimFriedman2 Jul 20, 2026
0821217
turn `HirDatabase` into an extension trait
ada4a Jul 14, 2026
47827ff
remove `query-group-macro`
ada4a Jul 15, 2026
82445ad
Merge pull request #22867 from dfireBird/push-qyookpnnzqok
Veykril Jul 20, 2026
edd9aec
Merge pull request #22831 from ada4a/unquerygroup-hirdatabase
Veykril Jul 20, 2026
c918732
add `declare_id_wrapper_with_lt`
ada4a Jun 17, 2026
cda6009
add lifetime to `InternedOpaqueTyId`
ada4a Jun 17, 2026
6c1901f
Merge pull request #22611 from ada4a/lt-for-interned_opaque_ty_id
Veykril Jul 20, 2026
5dab5cb
Change unsupported toolchain version to match reality
ChayimFriedman2 Jul 21, 2026
d88ebcf
Merge pull request #22876 from ChayimFriedman2/upgrade-unsupported-to…
ChayimFriedman2 Jul 21, 2026
19551c2
Do not detect `#[rust_analyzer]` as `#[rust_analyzer::rust_fixture]`
ChayimFriedman2 Jul 21, 2026
80db819
internal: add `Module::path_segments`, dedup the path-to-root name walk
enomado Jul 21, 2026
c28148f
Merge pull request #22883 from enomado/hir-module-path-segments
ChayimFriedman2 Jul 21, 2026
b14606e
Emit existing `MissingFields` diagnostic
TheDoctor314 Jul 18, 2026
6df48f4
internal: refer to salsa macros using `salsa::`
ada4a Jul 22, 2026
6756f20
remove the no longer needed `salsa-macros` deps
ada4a Jul 22, 2026
38efdf3
fix: no_such_field should ignore non-editable crates
Wilfred Jul 22, 2026
6ac189d
fix: no_such_field panic with macros
Wilfred Jul 22, 2026
c5a5964
Use token-based implements
A4-Tacks Jul 22, 2026
e2e9258
fix: merge_imports panic on invalid paths
Wilfred Jul 22, 2026
8768e74
fix: uses bool instead pat ty in guard
A4-Tacks Jul 24, 2026
e244a96
Merge pull request #22896 from A4-Tacks/guard-expected-ty
ChayimFriedman2 Jul 24, 2026
d05f397
fix: add parentheses for invert general expression
A4-Tacks Jul 24, 2026
6936c08
fix: attach db on worker threads in parallel analysis-stats inference
tilladam Jul 24, 2026
528bbbc
Merge pull request #22905 from tilladam/fix-parallel-inference-attach-db
Veykril Jul 24, 2026
d80efc9
Merge pull request #22898 from A4-Tacks/invert-general-needs-paren
Veykril Jul 24, 2026
c968662
Merge pull request #22885 from ada4a/push-txoywxkpkntz
Veykril Jul 24, 2026
b91043d
Merge pull request #22881 from ChayimFriedman2/ra-no-fixture
Veykril Jul 24, 2026
d80d0ad
Merge pull request #22843 from Wilfred/fix/no-such-field-macro-offset
Veykril Jul 24, 2026
3e5c09e
Merge pull request #22892 from Wilfred/fix/merge-imports-malformed-paths
Veykril Jul 24, 2026
dd32b4f
Fix stale lock file
Veykril Jul 25, 2026
f441fa8
Merge pull request #22908 from Veykril/lukaswirth/push-mzmtowqynstt
Veykril Jul 25, 2026
1fbf6ff
internal: scoped cache priming
tilladam Jun 13, 2026
4958f98
Merge pull request #22587 from tilladam/perf/scoped-lazy-priming
Veykril Jul 25, 2026
0bd28ac
Merge pull request #22851 from TheDoctor314/fixme-error-incomplete-st…
ChayimFriedman2 Jul 25, 2026
352ab10
Merge pull request #22854 from Veykril/lukaswirth/push-mxzkovmksnut
ChayimFriedman2 Jul 25, 2026
70847a5
Remove format_args lowering for toolchains prior to 1.94.0
ChayimFriedman2 Jul 25, 2026
5e63626
Remove lockfile-path support for Cargo versions below 1.94.0
ChayimFriedman2 Jul 25, 2026
3ce7165
Remove support for `#[rustc_box]`
ChayimFriedman2 Jul 25, 2026
222ac69
Require `MetaSized`
ChayimFriedman2 Jul 25, 2026
9f6fa9b
Remove `min_align_of[_val]()` intrinsic
ChayimFriedman2 Jul 25, 2026
b93869f
Remove support for `None` `Op::Count` in MBE
ChayimFriedman2 Jul 25, 2026
679271e
replace detach with delete in edit
bit-aloo Jul 26, 2026
e1bc5df
Merge pull request #22916 from Shourya742/2026-07-26-replace-detach-w…
ChayimFriedman2 Jul 26, 2026
641ff3c
fix: don't offer `replace_qualified_name_with_use` on an unqualified …
shulaoda Jul 26, 2026
a1368ec
Merge pull request #22919 from shulaoda/07-26-fix_don_t_offer_replace…
ChayimFriedman2 Jul 26, 2026
3aaba95
fix: prefer `alloc` over `std` paths when `preferNoStd` is set
shulaoda Jul 26, 2026
03b9e33
Merge pull request #22918 from shulaoda/07-26-fix_prefer_alloc_over_s…
ChayimFriedman2 Jul 26, 2026
5d1d4b3
fix: Fix `.zip(None)` call
Veykril Jul 26, 2026
c9043b7
Merge pull request #22924 from Veykril/lukaswirth/push-vyxsrxpymtlm
Veykril Jul 26, 2026
573bd7d
Add regression test for rust-lang/rust-analyzer#22913
Veykril Jul 26, 2026
1c820a1
Merge pull request #22914 from ChayimFriedman2/remove-old-versions
ChayimFriedman2 Jul 26, 2026
c1f175c
Merge pull request #22925 from Veykril/lukaswirth/push-yvtwmnwqqxul
Veykril Jul 26, 2026
04e90a4
fix: give `impl_trait_with_diagnostics` a cycle result
shulaoda Jul 26, 2026
f45f979
Merge pull request #22923 from shulaoda/07-26-fix_give_impl_trait_wit…
ChayimFriedman2 Jul 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 49 additions & 29 deletions src/tools/rust-analyzer/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,60 @@
**Reminder: All AI usage must be disclosed in commit messages, see
CONTRIBUTING.md for more details.**
## AI Policy

## Build Commands
Follow `AI_POLICY.md`. In particular:

```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
```
- Do not use AI to author issue/PR comments or replies to maintainers.
- Do not autonomously open issues or pull requests.
- Do not author code for issues labeled both `E-easy` and `E-has-instructions`.
- The human contributor must understand the changes and disclose AI use as required by the policy.

## 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
## Repository Guides

### Code Generation
- Architecture and crate ownership: `docs/book/src/contributing/architecture.md`
- Rust style: `docs/book/src/contributing/style.md`
- Testing conventions and fixture syntax: `docs/book/src/contributing/testing.md`
- Contributor workflows: `docs/book/src/contributing/README.md`
- AI restrictions: `AI_POLICY.md`

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).
Read the relevant sections before making architectural, generated-code, protocol, or test-harness changes.

## Change Workflow

- Find the nearest existing implementation and its tests before adding new code.
- Extend existing helpers and test harnesses instead of creating parallel abstractions.
- Keep changes focused and prefer the smallest change that fits the existing design.
- When fixing a bug, add the smallest fixture that reproduces it and test the behavior through the existing interface.

## Scope and Dependencies

- Treat new `pub` items, public re-exports, and Cargo dependencies as architectural changes, not routine implementation details.
- Prefer keeping functionality inside the crate that owns the relevant data.
- Be conservative with crates.io dependencies. Reuse existing dependencies or `stdx`; do not add small helper crates without strong justification.

## Key Invariants

- User-provided Rust code, malformed syntax, broken builds, and proc-macro failures must not cause ordinary IDE features to panic.
- Assert invariants liberally. For impossible conditions from which the server can recover, prefer `stdx::never!` or `stdx::always!` and return a safe fallback instead of panicking.

## 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
- Many feature tests use Rust-code fixtures and `expect-test` snapshots. Follow the nearest existing test helper and fixture convention rather than introducing a new test harness.
- Before planning or writing fixture-based tests, review `docs/book/src/contributing/testing.md` for fixture annotations, `minicore`, and multi-file/multi-crate syntax.
- Keep Rust fixtures minimal; remove syntax unrelated to the behavior under test.
- Use unindented multiline raw strings, matching nearby tests.
- For regressions, first reproduce the failure with a focused test, then implement the fix.

## Generated Code

- Generated files are committed. Edit the generator rather than generated output.
- Run `cargo xtask codegen` after changing grammar, generated AST definitions, configuration schemas, or other codegen inputs.
- After adding parser inline tests (`// test name`), run `cargo test -p xtask`, update the relevant expectations, and inspect the generated diff.

## Style Notes
## Validation

- 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`
- Start with the narrowest relevant test: `cargo test -p <crate> <test-name>` or `cargo test -p <crate>`.
- After Rust changes, run the affected crate's tests and `cargo clippy -p <crate> --all-targets -- --cap-lints warn`; broaden validation when the change crosses crates.
- Use `cargo lint` to run Clippy on all workspace targets.
- Run `cargo xtask tidy` for repository-wide structural or generated-code changes.
- When updating snapshots with `UPDATE_EXPECT=1`, inspect the expectation diff rather than accepting it blindly.
- Use `RUN_SLOW_TESTS=1 cargo test` when the affected area has slow tests.
24 changes: 6 additions & 18 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ dependencies = [
"indexmap",
"intern",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"query-group-macro",
"rustc-hash 2.1.2",
"salsa",
"salsa-macros",
Expand Down Expand Up @@ -825,6 +824,7 @@ dependencies = [
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ra-ap-rustc_type_ir",
"rustc-hash 2.1.2",
"salsa",
"serde_json",
"smallvec",
"span",
Expand Down Expand Up @@ -863,7 +863,6 @@ dependencies = [
"rustc-hash 2.1.2",
"rustc_apfloat",
"salsa",
"salsa-macros",
"smallvec",
"span",
"stdx",
Expand Down Expand Up @@ -892,7 +891,6 @@ dependencies = [
"parser",
"rustc-hash 2.1.2",
"salsa",
"salsa-macros",
"smallvec",
"span",
"stdx",
Expand Down Expand Up @@ -925,7 +923,6 @@ dependencies = [
"oorandom",
"petgraph",
"project-model",
"query-group-macro",
"ra-ap-rustc_abi",
"ra-ap-rustc_ast_ir",
"ra-ap-rustc_index",
Expand All @@ -935,7 +932,6 @@ dependencies = [
"rustc-hash 2.1.2",
"rustc_apfloat",
"salsa",
"salsa-macros",
"serde",
"serde_derive",
"smallvec",
Expand Down Expand Up @@ -1136,7 +1132,6 @@ dependencies = [
"rayon",
"rustc-hash 2.1.2",
"salsa",
"salsa-macros",
"smallvec",
"span",
"stdx",
Expand Down Expand Up @@ -2037,18 +2032,6 @@ dependencies = [
"pulldown-cmark",
]

[[package]]
name = "query-group-macro"
version = "0.0.0"
dependencies = [
"expect-test",
"proc-macro2",
"quote",
"salsa",
"salsa-macros",
"syn",
]

[[package]]
name = "quick-error"
version = "1.2.3"
Expand Down Expand Up @@ -2484,6 +2467,7 @@ dependencies = [
"smallvec",
"thin-vec",
"tracing",
"triomphe",
"typeid",
]

Expand Down Expand Up @@ -3089,6 +3073,10 @@ name = "triomphe"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39"
dependencies = [
"serde",
"stable_deref_trait",
]

[[package]]
name = "tt"
Expand Down
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ salsa = { version = "0.27.0", default-features = false, features = [
"salsa_unstable",
"macros",
"inventory",
"triomphe"
] }
salsa-macros = "0.27.0"
semver = "1.0.26"
Expand Down
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/base-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ la-arena.workspace = true
dashmap.workspace = true
salsa.workspace = true
salsa-macros.workspace = true
query-group.workspace = true
rustc-hash.workspace = true
triomphe.workspace = true
semver.workspace = true
Expand Down
57 changes: 12 additions & 45 deletions src/tools/rust-analyzer/crates/base-db/src/editioned_file_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,24 @@ pub struct EditionedFileId {
field: span::EditionedFileId,
}

// Currently does not work due to a salsa bug
// #[salsa::tracked]
// impl EditionedFileId {
// #[salsa::tracked(lru = 128)]
// pub fn parse(self, db: &dyn SourceDatabase) -> syntax::Parse<ast::SourceFile> {
// let _p = tracing::info_span!("parse", ?self).entered();
// let (file_id, edition) = self.unpack(db);
// let text = db.file_text(file_id).text(db);
// ast::SourceFile::parse(text, edition)
// }

// // firewall query
// #[salsa::tracked(returns(as_deref))]
// pub fn parse_errors(self, db: &dyn SourceDatabase) -> Option<Box<[SyntaxError]>> {
// let errors = self.parse(db).errors();
// match &*errors {
// [] => None,
// [..] => Some(errors.into()),
// }
// }
// }

#[salsa::tracked]
impl EditionedFileId {
#[salsa::tracked(lru = 128)]
pub fn parse(self, db: &dyn SourceDatabase) -> syntax::Parse<ast::SourceFile> {
#[salsa::tracked(lru = 128)]
pub fn parse(
db: &dyn SourceDatabase,
file_id: EditionedFileId,
) -> syntax::Parse<ast::SourceFile> {
let _p = tracing::info_span!("parse", ?file_id).entered();
let (file_id, edition) = file_id.unpack(db);
let text = db.file_text(file_id).text(db);
ast::SourceFile::parse(text, edition)
}
parse(db, self)
let _p = tracing::info_span!("parse", ?self).entered();
let (file_id, edition) = self.unpack(db);
let text = db.file_text(file_id).text(db);
ast::SourceFile::parse(text, edition)
}

// firewall query
pub fn parse_errors(self, db: &dyn SourceDatabase) -> Option<&[SyntaxError]> {
#[salsa::tracked(returns(as_deref))]
pub fn parse_errors(
db: &dyn SourceDatabase,
file_id: EditionedFileId,
) -> Option<Box<[SyntaxError]>> {
let errors = file_id.parse(db).errors();
match &*errors {
[] => None,
[..] => Some(errors.into()),
}
#[salsa::tracked(returns(as_deref))]
pub fn parse_errors(self, db: &dyn SourceDatabase) -> Option<Box<[SyntaxError]>> {
let errors = self.parse(db).errors();
match &*errors {
[] => None,
[..] => Some(errors.into()),
}
parse_errors(db, self)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/base-db/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl BuiltDependency {

pub type CratesIdMap = FxHashMap<CrateBuilderId, Crate>;

#[salsa_macros::input]
#[salsa::input]
#[derive(Debug, PartialOrd, Ord)]
pub struct Crate {
#[returns(ref)]
Expand Down
Loading
Loading