Lukas Wirth
3aecf081f6
Merge pull request #20996 from A4-Tacks/explicit-dot-call-deref
...
Add ide-assist: add_explicit_method_call_deref
2025-12-21 13:50:43 +00:00
A4-Tacks
f0055f6557
Add parent_match method to node_ext
2025-12-21 12:54:47 +08: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
Chayim Refael Friedman
459982c158
Fix a panic in ast::TypeBound::kind()
2025-12-12 00:45:37 +02:00
Jieyou Xu
acb575c6ab
rust-analyzer: prep crates for testing against in-tree rustc_private
2025-12-11 20:22:49 +08:00
Shoyu Vanilla (Flint)
e8ac25242f
Merge pull request #21044 from A4-Tacks/fix-make-unnamed-param
...
Fix make::unnamed_param result a untyped_param
2025-12-09 04:45:26 +00:00
Shoyu Vanilla (Flint)
a071c5cb04
Merge pull request #21174 from Young-Flash/migrate_convert_iter_for_each_to_for
...
internal: migrate `convert_iter_for_each_to_for` to SyntaxEditor api
2025-12-08 07:11:26 +00:00
Shoyu Vanilla (Flint)
3dfe74e02d
Merge pull request #21199 from Young-Flash/migrate_generate_delegate_trait
...
internal: migrate `generate_delegate_trait` to SyntaxEditor api
2025-12-08 07:10:19 +00:00
Young-Flash
d5ea35572b
minor: add missing SyntaxFactory::assoc_item_list
2025-12-05 20:27:30 +08:00
Young-Flash
1a5d1bf56d
minor: fmt & clippy
2025-12-04 23:30:01 +08:00
Cheuk Yin Ng
beb694b977
fix(spelling): underling -> underlying
2025-12-01 23:21:18 -08:00
Young-Flash
80d511fcd8
internal: add missing method for SyntaxFactory
2025-12-01 22:05:24 +08: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
Shoyu Vanilla (Flint)
3ee32218fe
Merge pull request #21023 from A4-Tacks/syntax-editor-duplicate-changed
...
Fix syntax_editor duplicated changed element
2025-11-28 10:48:45 +00:00
Lukas Wirth
1ea2498b49
Merge pull request #20163 from ChayimFriedman2/parser-per-token-edition
...
fix: Use per-token, not global, edition in the parser
2025-11-28 08:11:38 +00:00
Young-Flash
4f4466302e
internal: add missing method for SyntaxFactory
2025-11-25 22:37:48 +08:00
Shoyu Vanilla (Flint)
e540a446de
Merge pull request #21090 from asuto15/fix/#21063
...
fix: Enhance remove_parentheses assist to handle return expressions
2025-11-23 04:42:55 +00:00
asuto15
14fa82bd8b
fix: Enhance remove_parentheses assist to handle return expressions
2025-11-23 12:51:05 +09:00
Lukas Wirth
c16b39c131
analysis_stats: Record lang item queries, disable async drop in stats
2025-11-22 21:20:23 +01:00
Aditya-PS-05
b80ca3f35e
fix: never remove parens from prefix ops with valueless return/break/continue
2025-11-20 04:01:14 +05:30
Lukas Wirth
a3910c6f14
syntax: Drop Parse on separate thread
...
Rowan's green nodes are super drop heavy and as lru eviction happens on cancellation this can block for quite some time, especially after cache priming
2025-11-17 11:19:43 +01:00
A4-Tacks
4fb242e4bf
Fix make::unnamed_param result a untyped_param
...
- Add `make::untyped_param`
- Add some basic make tests
Example
---
```rust
make::unnamed_param(make::ty("Vec<T>")),
```
**Before this PR**
```text
PARAM@0..4
IDENT_PAT@0..4
NAME@0..4
IDENT@0..4 "Vec"
```
**After this PR**
```text
PARAM@0..6
PATH_TYPE@0..6
PATH@0..6
PATH_SEGMENT@0..6
NAME_REF@0..3
IDENT@0..3 "Vec"
GENERIC_ARG_LIST@3..6
L_ANGLE@3..4 "<"
TYPE_ARG@4..5
PATH_TYPE@4..5
PATH@4..5
PATH_SEGMENT@4..5
NAME_REF@4..5
IDENT@4..5 "T"
R_ANGLE@5..6 ">"
```
---
Assist: `Generate a type alias for function with unnamed params`
```rust
fn foo$0(x: Vec<i32>) {}
```
**Before this PR**
```rust
type FooFn = fn(Vec);
fn foo(x: Vec<i32>) {}
```
**After this PR**
```rust
type FooFn = fn(Vec<i32>);
fn foo(x: Vec<i32>) {}
```
2025-11-16 17:34:54 +08:00
A4-Tacks
d48361b47b
Fix syntax_editor duplicated changed tokens
2025-11-12 13:34:28 +08:00
A4-Tacks
b8bbebf4f0
Fix syntax_editor duplicated changed element
...
Example
---
```rust
let arg_list = make::arg_list([make::expr_literal("1").into(), make::expr_literal("2").into()]);
let mut editor = SyntaxEditor::new(arg_list.syntax().clone());
let target_expr = make::expr_literal("3").clone_for_update();
for arg in arg_list.args() {
editor.replace(arg.syntax(), target_expr.syntax());
}
let edit = editor.finish();
let expect = expect![["(3, 3)"]];
expect.assert_eq(&edit.new_root.to_string());
```
**Before this PR**
```text
(, )3
```
**After this PR**
```text
(3, 3)
```
2025-11-11 18:52:40 +08:00
A4-Tacks
d53146a013
Add ide-assist: add_explicit_method_call_deref
...
Insert explicit method call reference and dereferences.
Example
---
```rust
struct Foo;
impl Foo { fn foo(&self) {} }
fn test() {
Foo$0.$0foo();
}
```
->
```rust
struct Foo;
impl Foo { fn foo(&self) {} }
fn test() {
(&Foo).foo();
}
```
2025-11-08 21:55:36 +08:00
A4-Tacks
8549afe4a6
Add ide-assist: convert_range_for_to_while
...
Convert for each range into while loop.
```rust
fn foo() {
$0for i in 3..7 {
foo(i);
}
}
```
->
```rust
fn foo() {
let mut i = 3;
while i < 7 {
foo(i);
i += 1;
}
}
```
2025-11-04 13:31:41 +08:00
Johannes Altmanninger
70f972c2fd
Fix rustfmt for files that use 2024-edition syntax
...
"cargo fmt" works fine but "rustfmt" fails to format some files.
$ rustfmt crates/ide-db/src/search.rs
error: let chains are only allowed in Rust 2024 or later
--> /home/johannes/git/rust-analyzer/crates/ide-db/src/search.rs:298:12
|
298 | if let &Definition::Module(module) = self
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I guess I could work around this by setting my format command to
"cargo fmt -- $filename" instead of "rustfmt $filename".
But it'd be nice if this worked OOTB. Make it so by adding specifying
the edition in rustfmt.toml. We already have several other places
specifying the edition.
changelog internal
2025-10-23 23:13:13 +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
A4-Tacks
e4cceca607
Fix not applicable c-str and byte-str for raw_string
...
Example
---
Assist: `make_raw_string`
```rust
fn f() {
let s = $0b"random\nstring";
}
```
->
```rust
fn f() {
let s = br#"random
string"#;
}
```
---
Assist: `make_raw_string`
```rust
fn f() {
let s = $0c"random\nstring";
}
```
->
```rust
fn f() {
let s = cr#"random
string"#;
}
```
---
Assist: `add_hash`
```rust
fn f() {
let s = $0cr"random string";
}
```
->
```rust
fn f() {
let s = cr#"random string"#;
}
```
---
Assist: `remove_hash`
```rust
fn f() {
let s = $0cr#"random string"#;
}
```
->
```rust
fn f() {
let s = cr"random string";
}
```
---
Assist: `make_usual_string`
```rust
fn f() {
let s = $0cr#"random string"#;
}
```
->
```rust
fn f() {
let s = c"random string";
}
```
2025-10-10 19:04:48 +08:00
Chayim Refael Friedman
e3287fc878
Impl std::error::Error for SyntaxError
2025-09-30 15:40:54 +03:00
Chayim Refael Friedman
6da1ce7869
Merge pull request #20624 from A4-Tacks/fix-syn-lifetime-bounds
...
Fix LifetimeParam::lifetime_bounds invalid implement
2025-09-09 07:35:19 +00:00
A4-Tacks
080f2b3f71
Fix LifetimeParam::lifetime_bounds invalid implement
...
Lifetime node example:
```
LIFETIME_PARAM@15..21
LIFETIME@15..17
LIFETIME_IDENT@15..17 "'a"
COLON@17..18 ":"
WHITESPACE@18..19 " "
TYPE_BOUND_LIST@19..21
TYPE_BOUND@19..21
LIFETIME@19..21
LIFETIME_IDENT@19..21 "'b"
```
2025-09-09 15:22:12 +08:00
A4-Tacks
7e2dc40642
Improve make::struct_ field_list whitespace
...
Example
---
**Before this PR**:
```rust
struct Variant{
field: u32
}
```
**After this PR**:
```rust
struct Variant {
field: u32
}
```
2025-09-07 22:19:52 +08:00
Chayim Refael Friedman
9bc940a23c
Use per-token edition in the parser
2025-08-13 20:37:46 +03:00
Deadbeef
82f174fbd9
Merge Trait and TraitAlias handling
2025-08-13 15:28:08 +08:00
Hmikihiro
fcd4010b03
In extract_module.rs, generate ast::Module instead of String
2025-08-07 02:29:59 +09:00
Hmikihiro
c57a42acf3
remvoe add_attr edit_in_place.rs because it use ted.
2025-08-04 21:52:49 +09:00
Hmikihiro
1fea875fb1
Remove unused functions from edit_in_place
2025-08-03 19:40:54 +09:00
Hmikihiro
85f7112c0e
Migrate generate_delegate_methods assist to use SyntaxEditor
2025-08-03 02:17:56 +09:00
Shoyu Vanilla (Flint)
68e7ec90bf
Merge pull request #20345 from Hmikihiro/Migrate_add_trait_assoc_items_to_impl
...
add `SyntaxEditor::delete_all` to migrate utils.rs `add_trait_assoc_items_to_impl`
2025-07-31 15:11:22 +00:00
Lukas Wirth
8ce30264c8
cargo clippy --fix
2025-07-31 10:55:10 +02:00
Hmikihiro
e600060680
add SyntaxEditor::delete_all to migrate utils.rs add_trait_assoc_items_to_impl
2025-07-30 23:53:05 +09:00
Hmikihiro
ec02abf97a
add SyntaxFactory::record_expr to hide clone_for_update
2025-07-29 21:49:03 +09:00
Hayashi Mikihiro
82dfdacb78
Modify around add_trait_assoc_items_to_impl to migrate add_missing_impl_members
...
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2025-07-26 00:22:29 +09:00
Shoyu Vanilla (Flint)
fa64d3b720
Merge pull request #20281 from ChayimFriedman2/parse-hrtb-const
...
fix: Parse `for<'a> [const]`
2025-07-23 01:50:16 +00:00
Chayim Refael Friedman
c7ceb39f67
Parse for<'a> [const]
...
And also refactor parsing of HRTB.
2025-07-22 16:24:42 +03:00
Shoyu Vanilla (Flint)
bdfc7709bf
Merge pull request #20269 from Hmikihiro/migrate_indent_mapping
...
Migrate AstNodeEdit::Indent to SyntaxEditor
2025-07-22 04:07:47 +00:00
Hayashi Mikihiro
9cc03e01c5
migrate generate new
2025-07-21 17:22:03 +09:00