608 Commits

Author SHA1 Message Date
Lukas Wirth
bbd40f8780
Merge pull request #21341 from Veykril/veykril/push-wsrtvrkzqyvr
internal: Move library and local root inputs to base-db
2025-12-27 10:24:52 +00:00
Lukas Wirth
1c67944f99 internal: Move library and local root inputs to base-db 2025-12-27 11:16:17 +01:00
Lukas Wirth
e08a7862a8
Merge pull request #20741 from A4-Tacks/comp-macro-segment
feat: Add macro segment completion
2025-12-27 10:02:35 +00:00
A4-Tacks
b5baf71afb
Minor fixup 2025-12-27 17:28:22 +08:00
A4-Tacks
d2cc89ffc7
Add macro segment completion
Example
---
```rust
macro_rules! foo {
    ($($x:$0)*) => ();
}
```

**Completion items**:

```text
ba block
ba expr
ba expr_2021
ba ident
ba item
ba lifetime
ba literal
ba meta
ba pat
ba pat_param
ba path
ba stmt
ba tt
ba ty
ba vis
```
2025-12-27 05:04:18 +08:00
Lukas Wirth
8c5a68e214
Merge pull request #21200 from ChayimFriedman2/fake-impls
perf: Do not really expand builtin derives, instead treat them specifically
2025-12-26 13:31:48 +00:00
Chayim Refael Friedman
bd934c08cf Allow IDE layer to "see" fake builtin derive impls
It sees them as regular impls; the details are abstracted. It's beautiful for the IDE layer, and less beautiful for `hir`, so this is a big change.

Some small differences still exist:

 - We show builtin derives impl (to the IDE layer) as if they have had no generic parameters. It is possible to show the parameters, but that means also having to handle fake impls in `TypeParam` etc., and the benefit is questionable.
 - Getting the fn *def* type of a method of a builtin derive impl is not supported, as there is no real `FunctionId`, therefore no `CallableDefId`. The trait method is returned instead. Note: getting the fn *ptr* type of the method is supported well.
 - Builtin derive impls and their methods do not fully support `HasSource`, because, well, they have no source (at least, not in the form of `ast::Impl` and `ast::Fn`). To support them, we use the derive's `TextRange` where possible, and the trait method's source when not.

 It's important to note that the def map still records the `MacroCallId`. I have doubts over this, as this means it's very easy to create the queries we don't want to create, but it does make things more convenient. In particular, a nicety of this setup is that even "Expand macro recursively" works (it creates the macro input/output query, but given that they will only be created when the user invokes the command, that does not seem to be a problem).
2025-12-26 15:00:08 +02:00
Lukas Wirth
97ac158aaa
Merge pull request #20193 from ChayimFriedman2/setting-rename-conflict
feat: Provide a setting to disable showing rename conflicts
2025-12-26 09:08:49 +00:00
A4-Tacks
ac01f880d7
Add BreakExpr completion suggest
- Move `ide::goto_definition::find_loops`
  into `ide_db::syntax_helpers::node_ext::find_loops`
2025-12-22 20:13:56 +08:00
A4-Tacks
847317ccba
Add default varname for TryEnum postfix completion
Example
---
```rust
fn main() {
    let bar = Some(true);
    bar.i$0
}
```

**Before this PR**

```rust
fn main() {
    let bar = Some(true);
    if let Some($1) = bar {
        $0
    }
}
```

**After this PR**

```rust
fn main() {
    let bar = Some(true);
    if let Some(${1:bar}) = bar {
        $0
    }
}
```
2025-12-21 13:55:21 +08: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
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
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
Lukas Wirth
0da7839f48 internal: Give FileSymbol it's 'db lifetime 2025-12-14 10:54:13 +01:00
Jieyou Xu
acb575c6ab
rust-analyzer: prep crates for testing against in-tree rustc_private 2025-12-11 20:22:49 +08:00
Lukas Wirth
30550d917b Make ModuleId a tracked struct
optimize some stuff

Optimize `pub(crate)` visibility resolution

Optimize private visibility resolution
2025-12-07 09:31:19 +01:00
The rustc-josh-sync Cronjob Bot
4f45c093e1 Merge ref 'dfe1b8c97bcd' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: dfe1b8c97bcde283102f706d5dcdc3649e5e12e3
Filtered ref: d3d1f3831e6b7fa73889d90bc8dd56d22cb80834
Upstream diff: 1be6b13be7...dfe1b8c97b

This merge was created using https://github.com/rust-lang/josh-sync.
2025-12-01 04:34:35 +00:00
Chayim Refael Friedman
f0e372c3b6 Rewrite attribute handling
Basically, we switch to expanding cfg_attr in AST form, filter irrelevant attributes from the item tree, and move hir-def attributes (non-item-tree) to be flag-based.

The main motivation is memory usage, although this also simplifies the code, and fixes some bugs around handling of `cfg_attr`s.
2025-11-29 18:52:18 +02:00
Stuart Cook
a27baea97d
Rollup merge of #149087 - nxsaken:unchecked_neg_shifts_stabilize, r=Amanieu
Stabilize `unchecked_neg` and `unchecked_shifts`

Features: `unchecked_neg`, `unchecked_shifts`
Tracking issue: rust-lang/rust#85122

r? `@Amanieu`
2025-11-28 15:30:43 +11:00
Laurențiu Nicola
45ae0abfed
Merge pull request #21126 from A4-Tacks/arglist-nr-error-comma
fix: fix parameter info with missing arguments
2025-11-25 12:50:22 +00:00
A4-Tacks
1d40867fc8
Fix invalid completion arg nr
Example
---
```rust
fn foo() { bar(, $0); }
fn bar(x: u32, y: i32) {}
```

**Before this PR**

```text
ty: u32, name: x
```

**After this PR**

```text
ty: i32, name: y
```
2025-11-25 16:13:59 +08:00
Zalathar
fe1469ebd1 Basic support for declarative attribute/derive macros 2025-11-24 21:50:56 +11:00
Lukas Wirth
cf4b1faea3
Merge pull request #21097 from Veykril/push-zpqupukpkrts
proc-macro-srv: Reimplement token trees via immutable trees
2025-11-24 09:09:16 +00:00
Louis Maddox
2443cce41a fix: no unused tracing/attributes feature
- Discussed in https://github.com/rust-lang/rust-analyzer/issues/21107
- Avoids activating an `attributes` feature to crates that do not use it
- Updates the 6 crates that use attributes feature to specify it in
  their Cargo.toml: {hir,hir-def,hir-ty,ide-assists,ide-db,project-model}
2025-11-23 13:37:42 +00:00
Chayim Refael Friedman
2cba0b6be7
Merge pull request #21074 from Aditya-PS-05/fix/param-macro-names-21070
fix: show no error when parameters match macro names
2025-11-22 19:56:41 +00:00
Aditya-PS-05
d2ce37aef4 fix: don't qualify macro names in pattern bindings 2025-11-22 23:13:02 +05:30
Lukas Wirth
c26d5f5c82 Simplify 2025-11-22 13:45:53 +01:00
Lukas Wirth
f1804ae339 perf: Prime trait impls in cache priming 2025-11-21 15:48:42 +01:00
Aditya-PS-05
b6c3409ded fix: show no error when parameters match macro names 2025-11-20 18:19:18 +05:30
nxsaken
d5839ff14a Stabilize unchecked_neg and unchecked_shifts 2025-11-19 13:19:22 +04:00
Laurențiu Nicola
213a824b4d Merge ref '6159a44067eb' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 6159a44067ebce42b38f062cc7df267a1348e092
Filtered ref: 6ab1e12842abe4da734757701b2f17970e11f6b9
Upstream diff: c5dabe8cf7...6159a44067

This merge was created using https://github.com/rust-lang/josh-sync.
2025-11-19 08:27:10 +02:00
Chayim Refael Friedman
e8e02d5515
Merge pull request #20974 from ChayimFriedman2/ns4
fix: Rewrite method resolution to follow rustc more closely
2025-11-18 23:20:04 +00:00
Matthias Krüger
dba9069adc
Rollup merge of #149057 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to afcfe141ae.

Created using https://github.com/rust-lang/josh-sync.

r? `@ghost`
2025-11-18 16:52:12 +01:00
Lukas Wirth
d7aeed0b87
Merge pull request #21046 from Veykril/push-xluyprrqpzxz
perf: Improve start up time
2025-11-18 12:16:04 +00:00
Martin Kröning
1189b49a6f
doc: fix strict_provenance_lints tracking issue link 2025-11-17 17:23:55 +01:00
Lukas Wirth
5107faaae7 Prime lang item queries 2025-11-17 15:14:00 +01:00
Lukas Wirth
18851eb06b Merge pull request #20997 from Veykril/push-zsuorxrkpupr
perf: Only populate public items in dependency symbol index
2025-11-15 09:17:33 +02:00
Lukas Wirth
827be28900 Merge pull request #20995 from Veykril/push-kysxxnruzslp
internal: Move `SymbolsDatabase` over to new salsa style
2025-11-15 09:17:33 +02:00
Lukas Wirth
c1c6682e8b Merge pull request #20994 from Veykril/push-npvyklkuxnlr
perf: Reduce memory usage of symbol index
2025-11-15 09:17:33 +02:00
Chayim Refael Friedman
50384460c6 Rewrite method resolution to follow rustc more closely
It cannot be exactly the same, because we have needs rustc doesn't have (namely, accurate enumeration of all methods, not just with a specific name, for completions etc., while rustc also needs a best-effort implementation for diagnostics) but it is closer than the previous impl.

In addition we rewrite the closely related handling of operator inference and impl collection.

This in turn necessitate changing some other parts of inference in order to retain behavior. As a result, the behavior more closely matches rustc and is also more correct.

This fixes 2 type mismatches on self (1 remains) and 4 diagnostics (1 remains), plus some unknown types.
2025-11-05 18:43:36 +02:00
The rustc-josh-sync Cronjob Bot
ae9f97c299 Merge ref 'c5dabe8cf798' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: c5dabe8cf798123087d094f06417f5a767ca73e8
Filtered ref: 3214048a4d271548c85aae8ffc5f28ec73719235
Upstream diff: fb24b04b09...c5dabe8cf7

This merge was created using https://github.com/rust-lang/josh-sync.
2025-11-03 04:20:09 +00:00
Jakub Beránek
f0ff861dca
Generalize branch references to HEAD 2025-11-02 11:15:55 +01:00
Chayim Refael Friedman
44227800c6 Fix handling of blocks modules that are not the root module 2025-10-28 12:57:26 +02:00
Chayim Refael Friedman
4c709bad14 Consider all matches for flyimport even when searched with a qualifier 2025-10-27 19:26:27 +02:00
Chayim Refael Friedman
dc91c0a9f3 Provide a setting to disable showing rename conflicts 2025-10-27 18:04:33 +02:00
Chayim Refael Friedman
7a7ab993bb
Revert "internal: Rewrite attribute handling" 2025-10-22 19:19:13 +03:00
Chayim Refael Friedman
455ca02f17 Rewrite attribute handling
Basically, we switch to expanding cfg_attr in AST form, filter irrelevant attributes from the item tree, and move hir-def attributes (non-item-tree) to be flag-based.

The main motivation is memory usage, although this also simplifies the code, and fixes some bugs around handling of `cfg_attr`s.
2025-10-22 11:47:01 +03:00
Chayim Refael Friedman
81e621af0b Improve fixture support
Support more features beside highlighting, and support items from minicore.
2025-10-16 22:06:16 +03:00
Laurențiu Nicola
a01c123c75 Merge ref 'fb24b04b096a' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: fb24b04b096a980bffd80154f6aba22fd07cb3d9
Filtered ref: 8d328b994c70dfeed12717a13a915703ec939cfc
Upstream diff: 3369e82c6b...fb24b04b09

This merge was created using https://github.com/rust-lang/josh-sync.
2025-10-14 13:31:56 +03:00
Camille GILLOT
1b8d475ece Silence warning in r-a. 2025-10-11 20:50:21 +00:00