37440 Commits

Author SHA1 Message Date
Chayim Refael Friedman
fa4ea90fb2
Merge pull request #21295 from ChayimFriedman2/non-salsa-interneds-v3
perf: Non-Salsa-interned solver types - with GC for them
2025-12-20 15:56:46 +00:00
Chayim Refael Friedman
5e2dfbbd02 Add extensive docs for the unsafe operations 2025-12-18 17:30:20 +02:00
Chayim Refael Friedman
36c9f6224c GC support for solver types
A GC is triggered every X revisions, and is synchronous, unfortunately.
2025-12-18 10:12:03 +02:00
Chayim Refael Friedman
776c818882 Lay the basics for non-Copy solver types with GC
That means stop using Salsa for interning solver types.
2025-12-18 10:12:03 +02:00
Chayim Refael Friedman
ea1d2998f2
Merge pull request #21282 from J3m3/crate-attrs
feat: introduce `crate_attrs` field in `rust-project.json`
2025-12-18 01:38:37 +00:00
Jesung Yang
7f6858fd09 feat: introduce crate_attrs field in rust-project.json
Since the commit 50384460c68f
("Rewrite method resolution to follow rustc more closely"), the method
resolution logic has changed: rust-analyzer only looks up inherent
methods for primitive types in sysroot crates.

Unfortunately, this change broke at least one project that relies on
`rust-project.json`: Rust-for-Linux. Its auto-generated
`rust-project.json` directly embeds `core`, `alloc`, and `std` in the
`crates` list without defining `sysroot_src`. Consequently,
rust-analyzer fails to identify them as sysroot crates, breaking IDE
support for primitive methods (e.g., `0_i32.rotate_left(0)`).

However, specifying `sysroot_src` creates a new issue: it implicitly
adds `std` as a dependency to all kernel module crates, which are
actually compiled with `-Zcrate-attr=no_std`. Since rust-analyzer cannot
see compiler flags passed outside of the project definition, we need a
method to explicitly specify `#![no_std]` or, more generally,
crate-level attributes through the project configuration.

To resolve this, extend the `rust-project.json` format with a new
`crate_attrs` field. This allows users to specify crate-level attributes
such as `#![no_std]` directly into the configuration, enabling
rust-analyzer to respect them when analyzing crates.

References:
- The original Zulip discussion:
  https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Primitive.20type.20inherent.20method.20lookup.20fails/with/562983853
2025-12-18 01:27:43 +00:00
Chayim Refael Friedman
efdb3de4f2
Merge pull request #21298 from J3m3/item-tree-pretty
feat: pretty print attributes up to `cfg(false)`
2025-12-18 00:54:43 +00:00
Jesung Yang
dd33c82f6b feat: pretty print attributes up to cfg(false)
Extend ItemTree pretty-printing to include attributes even when a cfg
expression evaluates to false, emitting explicit `cfg(cfg_expr)` marker
after the attributes.

This improves testability of ItemTree attribute handling by exposing
more information in pretty-printed output.
2025-12-18 00:16:34 +00:00
Chayim Refael Friedman
02f53e88cf
Merge pull request #21294 from ChayimFriedman2/lang-items-redundant
minor: Remove redundant things from the lang items macro
2025-12-17 11:28:18 +00:00
Chayim Refael Friedman
edd49164aa Remove redundant things from the lang items macro 2025-12-17 13:18:10 +02:00
Chayim Refael Friedman
34fd9f65a3
Merge pull request #21283 from ChayimFriedman2/upgrade-salsa
internal: Upgrade Salsa
2025-12-17 11:09:07 +00:00
Shoyu Vanilla (Flint)
e500b2e86e
Merge pull request #21285 from ChayimFriedman2/remove-rust-outdated-ungram
minor: Remove Rust ungram file from the Ungrammar repo
2025-12-17 11:00:37 +00:00
Chayim Refael Friedman
4e54d37ba3 Upgrade Salsa
The new version gives an additional `salsa::Id` to cycle handlers, and renames `non_update_return_type` to `non_update_types`.
2025-12-17 12:59:30 +02:00
Chayim Refael Friedman
32d50921d6 Remove Rust ungram file from the Ungrammar repo
It can be confused with the real Rust ungram, now that they're in the same repo.
2025-12-16 21:59:12 +02:00
Lukas Wirth
2a402415ec
Merge pull request #21284 from ChayimFriedman2/upgrade-rustc
internal: Upgrade rustc crates
2025-12-16 15:37:11 +00:00
Chayim Refael Friedman
d7465cb5b7 Upgrade rustc crates
Changes:
 - `const_of_item()` was added to `Interner`, analogous to `type_of()`. No strongly-typed ID (yet).
 - New solver trait lang item: `TrivialClone`.
 - `TypeRelation` changed a bit, the code was copied from rustc.
2025-12-16 17:00:44 +02:00
Chayim Refael Friedman
92630ee98a
Merge pull request #21278 from A4-Tacks/mut-ref-type-match
Fix complete reference for `&mut ty` -> `&ty`
2025-12-16 08:52:33 +00:00
Chayim Refael Friedman
76cd4d6bf6
Merge pull request #21280 from ChayimFriedman2/fix-assert
minor: Fix an assert that didn't check what it should
2025-12-16 06:00:31 +00:00
Chayim Refael Friedman
14890be186 Fix an assert that didn't check what it should 2025-12-16 07:50:42 +02:00
Chayim Refael Friedman
9bd3aa9a30
Merge pull request #21279 from J3m3/no-downmap
internal: add special `ErasedFileAstId` used for bypassing downmapping
2025-12-16 05:43:45 +00:00
Jesung Yang
55451d38ee internal: add special ErasedFileAstId used for bypassing downmapping
Introduce `NO_DOWNMAP_ERASED_FILE_AST_ID_MARKER`, which prevents `Span`s
from being mapped down into macro expansions.

This is a preparatory step for adding a new field to the
`rust-project.json` format that can inject crate-level attributes.
`Span`s for those attributes will be marked with
`NO_DOWNMAP_ERASED_FILE_AST_ID_MARKER`, indicating that they should not
be mapped down into macro expansions.
2025-12-16 05:23:53 +00:00
Chayim Refael Friedman
0023f193e6
Merge pull request #21277 from A4-Tacks/strip-deref
Fix expected type no strip deref
2025-12-16 03:30:06 +00:00
A4-Tacks
d13d63c0a7
Fix add reference for &mut ty -> &ty
Example
---
```rust
fn foo(r: &mut i32) -> &i32 { $0 }
```

**Before this PR**

`lc &r [type+local]`

This is a compilation error

```rust
fn foo(r: &mut i32) -> &i32 { &r }
```

**After this PR**

`lc r &mut i32 [type+local]`

```rust
fn foo(r: &mut i32) -> &i32 { r }
```
2025-12-16 11:00:10 +08:00
A4-Tacks
d359992184
Fix expected type no strip deref
Example
---
```rust
fn main() {
    let r = &2;
    let _: fn() -> i32 = || *$0;
}
```

**Before this PR**

`ty: &'_ u32, name: x`

```rust
fn main() {
    let r = &2;
    let _: fn() -> i32 = || **r;
}
```

**After this PR**

`ty: &'_ &'_ u32, name: x`

```rust
fn main() {
    let r = &2;
    let _: fn() -> i32 = || *r;
}
```
2025-12-16 10:20:40 +08:00
Chayim Refael Friedman
87cfc881f1
Merge pull request #21032 from A4-Tacks/no-semicolon-in-arg-list
Fix complete unit return semicolon in arg-list
2025-12-16 01:10:02 +00:00
Chayim Refael Friedman
b272c3568b
Merge pull request #21240 from benodiwal/feat/inlay-hint-missing-argument
feat: show parameter hint for missing arguments
2025-12-15 23:28:07 +00:00
Shoyu Vanilla (Flint)
ae15c7cc01
Merge pull request #21273 from ChayimFriedman2/dup-sysroot-method-resolution
fix: Fix method resolution for incoherent impls when there are two sysroots in the crate graph
2025-12-15 19:14:03 +00:00
Chayim Refael Friedman
de46a13f15
Merge pull request #21258 from A4-Tacks/fix-add-ret-function-in-closure
Fix not applicable fn in closure for add_return_type
2025-12-15 19:02:35 +00:00
Chayim Refael Friedman
0408c5a748
Merge pull request #21266 from A4-Tacks/prec-paren-replace-let-with-iflet
Fix invalid logic op for replace_let_with_if_let
2025-12-15 19:01:23 +00:00
Chayim Refael Friedman
ccb1138f27
Merge pull request #21272 from ShoyuVanilla/sysroot-target
fix: Prefix json target file with workspace root for sysroot metadata
2025-12-15 18:42:59 +00:00
Chayim Refael Friedman
764552c5f4
Merge pull request #21276 from dfireBird/fix-21214
fix: use `cmark_with_options` to write shortcuts links to the output
2025-12-15 17:14:16 +00:00
dfireBird
e53d348f35
fix: use cmark_with_options to write shortcuts links to the output 2025-12-15 22:33:06 +05:30
Chayim Refael Friedman
ec12ffdb6a Fix method resolution for incoherent impls when there are two sysroots in the crate graph
Which can happen when two workspaces are opened, by only considering impls from dependencies of this crate.

I have no idea how to construct a test for this, but I tested it manually and it works.
2025-12-15 17:51:53 +02:00
Chayim Refael Friedman
90632683b3
Merge pull request #21270 from CatherineGasnier/fix-file-emitted-multiple-times
Fix "Invariant violation: file emitted multiple times" when doing `scip .`
2025-12-15 15:01:19 +00:00
Chayim Refael Friedman
3f37e42aeb
Merge pull request #21262 from dfireBird/hir-locals-used
feat: Implementation of locals_used in HIR level
2025-12-15 14:26:41 +00:00
Shoyu Vanilla
564034e3ec fix: Prefix json target file with workspace root for sysroot metadata 2025-12-15 23:22:19 +09:00
Catherine Gasnier
8b4e438fd5 Fix "Invariant violation: file emitted multiple times" when doing scip .
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
2025-12-15 06:21:39 -08:00
dfireBird
21713002ff
fix: consider path used in pattern destructing assignments
fix: assign mutable for variables in pattern destructing assignments
2025-12-15 17:28:05 +05:30
Laurențiu Nicola
3d78b3f9e0
Merge pull request #21268 from rust-lang/rustc-pull
minor: Rustc pull update
2025-12-15 09:49:44 +00:00
The rustc-josh-sync Cronjob Bot
f6c67ed0a4 Format code 2025-12-15 04:30:49 +00:00
The rustc-josh-sync Cronjob Bot
2d06e40dd0 Merge ref '0208ee09be46' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 0208ee09be465f69005a7a12c28d5eccac7d5f34
Filtered ref: 69b2702db74151cd410a028fb347c6e4e3f779dc
Upstream diff: dfe1b8c97b...0208ee09be

This merge was created using https://github.com/rust-lang/josh-sync.
2025-12-15 04:30:45 +00:00
The rustc-josh-sync Cronjob Bot
f77781c19d Prepare for merging from rust-lang/rust
This updates the rust-version file to 0208ee09be465f69005a7a12c28d5eccac7d5f34.
2025-12-15 04:25:42 +00:00
Chayim Refael Friedman
87cf6631c6
Merge pull request #21265 from J3m3/lint-attr-order
fix: respect rustc's lint attribute application order
2025-12-15
2025-12-14 22:33:33 +00:00
A4-Tacks
6f8c393514
Fix invalid logic op for replace_let_with_if_let
Example
---
```rust
fn main() {
    $0let x = true && false;
}
```

**Before this PR**

```rust
fn main() {
    if let x = true {
    }
}
```

**After this PR**

```rust
fn main() {
    if let x = (true && false) {
    }
}
```
2025-12-14 18:52:17 +08:00
Lukas Wirth
c410127c69
Merge pull request #21225 from Veykril/push-wpzrmoxzttuz
internal: Give `FileSymbol` it's `'db` lifetime
2025-12-14 10:04:46 +00:00
Lukas Wirth
0da7839f48 internal: Give FileSymbol it's 'db lifetime 2025-12-14 10:54:13 +01:00
bors
69b2702db7 Auto merge of #149273 - bjorn3:crate_locator_improvements, r=petrochenkov
Don't leak sysroot crates through dependencies

Previously if a dependency of the current crate depended on a sysroot crate, then `extern crate` would in the current crate would pick the first loaded version of said sysroot crate even in case of an ambiguity. This is surprising and brittle. For `-Ldependency=` we already blocked this since rust-lang/rust#110229, but the fix didn't account for sysroot crates.

Should fix https://github.com/rust-lang/rust/issues/147966
2025-12-14 09:16:11 +00:00
Lukas Wirth
7c063a52fc
Merge pull request #21264 from A4-Tacks/bind-unused-not-applicable-on-closure
Fix bind_unused_param applicable on closure
2025-12-14 09:13:41 +00:00
Lukas Wirth
67db7568e5
Merge pull request #21257 from Veykril/push-qnolwwkvuwxk
minor: Emit `WorkspaceDiagnosticRefresh` when flycheck finished
2025-12-14 09:05:23 +00:00
Lukas Wirth
4576663053
Merge pull request #21253 from tris203/lsp_didSave
fix(lsp): handle dynamic registration for didSave
2025-12-14 08:56:11 +00:00