24345 Commits

Author SHA1 Message Date
Wilfred Hughes
535783c2c5 fix: Clarify error messages when proc-macro-srv changes working directory
I'm investigating issues where users see a load of logs of the form:

```
Failed to set the current working dir to /redacted/path. Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
```

This is tricky to debug because there's two different code paths that
write exactly the same error message. Ensure they're unique.
2026-03-12 11:43:59 +00:00
Chayim Refael Friedman
8ed3cca4d3
Merge pull request #21794 from Albab-Hasan/fix/union-naming-validation
fix: add naming convention validation for `union` types
2026-03-11 01:53:21 +00:00
Ada Alakbarova
7ceb718a24
Remove outdated comment 2026-03-10 19:12:12 +01:00
Albab-Hasan
d5fc68f77d fix: implement naming convention validation for union types.
generated with ai assistance (claude sonnet 4.6).
2026-03-10 21:08:45 +06:00
guoyu
9914f3cac9 fix: handle multi-byte UTF-8 identifiers in NameGenerator::suggest_name
`split_numeric_suffix` used `rfind` to locate the last non-numeric
character and then split at `pos + 1`. Since `rfind` returns a byte
offset, this panics when the last non-numeric character is multi-byte
(e.g. CJK identifiers like `日本語`).

Use `str::ceil_char_boundary` to advance past the full character before
splitting.
2026-03-10 21:46:14 +08:00
Lukas Wirth
3e832f3a7b
Merge pull request #21771 from Wilfred/watch_dirs_recursively
fix: File watcher should watch directories recursively
2026-03-10 07:17:03 +00:00
Chayim Refael Friedman
16e4436162
Merge pull request #21789 from ChayimFriedman2/stupid-fix
minor: Fix a stupid typo
2026-03-09 10:47:51 +00:00
Chayim Refael Friedman
090dd8efef Fix a stupid typo 2026-03-09 12:38:32 +02:00
Lukas Wirth
e436269666 Do not re-query source roots per crate in analysis-stats 2026-03-09 11:08:57 +01:00
Laurențiu Nicola
2cf461f697
Merge pull request #21786 from rust-lang/rustc-pull
minor: sync from downstream
2026-03-09 08:32:23 +00:00
Lukas Wirth
833aa91b0d
Merge pull request #21785 from ChayimFriedman2/dup-assoc-res
fix: Allow duplicate assoc type shorthand resolution if it points to the same assoc type
2026-03-09 07:58:26 +00:00
Lukas Wirth
018847f906
Merge pull request #21767 from Veykril/push-xxyxurxwwmvy
Remove crate from salsa `EditionedFileId`
2026-03-09 07:57:57 +00:00
The rustc-josh-sync Cronjob Bot
8a6869d15a Merge ref 'eda4fc7733ee' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@eda4fc7733
Filtered ref: rust-lang/rust-analyzer@18005ba4c5
Upstream diff: f8704be04f...eda4fc7733

This merge was created using https://github.com/rust-lang/josh-sync.
2026-03-09 04:49:02 +00:00
Lukas Wirth
5abc9afe00 Remove crate from salsa EditionedFileId 2026-03-08 19:45:23 +01:00
Chayim Refael Friedman
dbab646097 Allow duplicate assoc type shorthand resolution if it points to the same assoc type
And with the same generic args.
2026-03-08 18:41:51 +02:00
A4-Tacks
51966da92d
Merge pull request #21782 from jaroslawroszyk/feat-parse-json
feat: add --json flag to rust-analyzer parse
2026-03-08 02:56:38 +00:00
Jaroslaw Roszyk
6ff82f9030 feat: add --json flag to rust-analyzer parse 2026-03-08 03:46:24 +01:00
Divyesh
5c47b6b28a ide-assists: remove unnecessary clones in two assists 2026-03-08 04:16:42 +05:30
Jonathan Brouwer
ee96c97d0b
Rollup merge of #152210 - Ozzy1423:attrs7, r=JonathanBrouwer
Gate #![reexport_test_harness_main] properly

Address the FIXME

Removed from `issue-43106-gating-of-builtin-attrs.rs` since that is for stable attributes only.

This would be a breaking change, search of github shows it is mostly but not always used with `#![test_runner]` which is already gated correctly.

Details:
https://github.com/rust-lang/rust/issues/50297

Feel free to close this issue if you think it is not worth addressing the FIXME...
2026-03-07 20:02:30 +01:00
A4-Tacks
a1b86d600f
Merge pull request #21774 from akashchakrabortymsc-cmd/migrate-unqualify-method-call
Migrate unqualify_method_call assist to SyntaxEditor
2026-03-07 09:58:33 +00:00
protonblu
467d73bd00 Migrate unqualify_method_call assist to SyntaxEditor 2026-03-07 12:44:36 +05:30
A4-Tacks
6522eb865a
Merge pull request #21734 from Shourya742/2026-03-02-migrate-already-migrated-assist-to-syntaxFactory
Replace make to syntax factory from already migrated syntax factory assist
2026-03-07 01:45:39 +00:00
Jason Haslam
7bc5632014 Fix syntax/fuzz build error 2026-03-06 11:35:35 -07:00
Wilfred Hughes
81cd9661f3 fix: File watcher should watch directories recursively
Currently rust-analyzer only watches the directory itself, and doesn't
consider children recursively.

This is a problem when the directory itself is deleted and
recreated (e.g. if you're creating all of `mycrate/src/` with a code
generating script). The obvious solution is to configure rust-analyzer
to watch the parent directory (assuming rust-project.json), but that
requires recursive watching.

This problem probably also occurs when switching between git commits.

Instead, watch directories recursively so we can use the file watcher
with parent directories.

See also discussion on rust-lang/rust-analyzer#19907.

I've tested on some decent sized projects (several hundred transitive
dependencies) and performance seemed fine.
2026-03-06 17:09:01 +00:00
Wilfred Hughes
0241582099 fix: Update VFS when a watched file is deleted
When rust-analyzer handles file watching, it previously wouldn't
update the VFS on file deletion. We would discard events where
fs::metadata() isn't available, and we never have metadata for deleted
files.

See also the discussion in rust-lang/rust-analyzer#19907.
2026-03-06 15:57:26 +00:00
Lukas Wirth
99fa130b86 fix: Fix invalid PartialEq impl for EditionedFileIdData
This broke the contract of `HashEqLike`, causing interning to return different IDs
2026-03-06 14:52:35 +01:00
bit-aloo
0e510d9eb1
add GetOrCreateWhereClause subtrait in edit to provide get_or_create_where_clause 2026-03-06 15:32:33 +05:30
bit-aloo
3faa0e1a5a
remove make from replace_named_generics_with_impl 2026-03-06 15:32:33 +05:30
bit-aloo
65c3f983a5
migrate move bounds to SyntaxEditor API 2026-03-06 15:32:33 +05:30
bit-aloo
776dfd7abe
remove make from move_bound 2026-03-06 15:32:33 +05:30
bit-aloo
52511b7cb6
remove make from generate_fn_type_alias_from_new 2026-03-06 15:32:33 +05:30
bit-aloo
01b8ebc91b
remove make from generate_default_from_new 2026-03-06 15:32:33 +05:30
bit-aloo
a5b96fc81d
remove make from convert_bool_to_enum 2026-03-06 15:32:33 +05:30
bit-aloo
6feab700fc
remove make from add_turbo_fish 2026-03-06 15:32:33 +05:30
bit-aloo
2aeb269257
remove make from extract_type_alias 2026-03-06 15:32:33 +05:30
A4-Tacks
c47f4e036a
fix: cfg_select supports non token-tree tokens
- Fix single non-curly groups is ignored `true => ((),)`, old: `(),`, new: `((),)`

Example
---
```rust
const _: i32 = cfg_select! { true => 2 + 3, _ => 3 + 4 };
```

**Before this PR**

```rust
const _: i32 = cfg_select! { true => 2 /* expected a token tree after `=>` */+ 3, _ => 3 + 4 };
```

**After this PR**

```rust
const _: i32 = 2 + 3;
```
2026-03-06 18:00:55 +08:00
Laurențiu Nicola
7e440b1d07 Tweak pre-release check for beta 2026-03-06 07:18:44 +02:00
Lukas Wirth
e8ee51ab9e
Merge pull request #21752 from ChayimFriedman2/question-mark-conversion
feat: When going to def on `?` on `Result` that goes through `From`, go to the `From` impl
2026-03-05 08:57:32 +00:00
The rustc-josh-sync Cronjob Bot
048bfabd85 Merge ref 'f8704be04fe1' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@f8704be04f
Filtered ref: rust-lang/rust-analyzer@5ecd3ed8b0
Upstream diff: e7d90c695a...f8704be04f

This merge was created using https://github.com/rust-lang/josh-sync.
2026-03-05 04:37:29 +00:00
Shoyu Vanilla (Flint)
87f5363056
Merge pull request #21750 from ChayimFriedman2/method-res-typingmode
fix: Do not use PostAnalysis TypingMode for IDE method resolution
2026-03-05 02:30:02 +00:00
Chayim Refael Friedman
202fd31d0b When going to def on ? on Result that goes through From, go to the From impl
It's more useful to users than going to `Try::branch()` impl from `Result`, which is in std.
2026-03-05 01:25:35 +02:00
Chayim Refael Friedman
398419b1e7 Do not use PostAnalysis TypingMode for IDE method resolution
As explained in the comments, PostAnalysis is good for most IDE things but not method resolution.

This fixes a bug which should not be impacted by this at all - return position impl trait in trait. It is currently lowered to an opaque, while it should be lowered to an anonymous associated type. But today when it is lowered as an opaque, this opaque of course has no definition and will normalize to an error, preventing method resolution on it from succeeding in some cases.
2026-03-04 22:06:36 +02:00
Jonathan Brouwer
403297d33a
Rollup merge of #152164 - mu001999-contrib:lint/unused_features, r=JonathanBrouwer
Lint unused features

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152164)*

Fixes rust-lang/rust#44232
Fixes rust-lang/rust#151752

---

This PR records used features through query side effect, then reports unsued features finally.
2026-03-04 19:30:36 +01:00
Shoyu Vanilla (Flint)
789ad51109
Merge pull request #21747 from ChayimFriedman2/never-upd-syn
fix: Allow never coercions in struct update syntax
2026-03-04 16:08:04 +00:00
Chayim Refael Friedman
1a6d91ea8f Allow never coercions in struct update syntax 2026-03-04 17:57:39 +02:00
Lukas Wirth
e8b19c9a93
Merge pull request #21745 from ChayimFriedman2/assoc-type-fixup
fix: Fix a bug in associated type lowering
2026-03-04 13:39:33 +00:00
Oscar Bray
06c5421774 Gate #![reexport_test_harness_main] properly 2026-03-04 08:29:44 +00:00
Chayim Refael Friedman
022f93973a
Merge pull request #21671 from A4-Tacks/postfix-tree-climbing
fix: offer block `.let` in ref-expr in match arm
2026-03-04 08:10:24 +00:00
Chayim Refael Friedman
bfa88ee8b2 Fix a bug in associated type lowering
When rewriting assoc type shorthand lowering (`TypeParam::AssocType`), I took into account that if two traits have the same assoc type, even if one is a supertrait of the other, it's an error. However it turns out that assoc type predicates (`Trait<AssocType = Foo>`) uses the same infrastructure, and there it's allowed to specify an ambiguous assoc type when it refers to a sub-trait. So make a distinction between ambiguous assoc type that comes from a supertrait and one that does not, and if it comes from a supertrait, keep the resolved assoc type for cases that need it.
2026-03-04 09:24:16 +02:00
Chayim Refael Friedman
09fe22e4d9
Merge pull request #21687 from A4-Tacks/destruct-self-param
feat: offer destructure_struct_binding on self param
2026-03-04 05:05:22 +00:00