Commit graph

307925 commits

Author SHA1 Message Date
Shoyu Vanilla (Flint)
efeb398cbf
Merge pull request #20895 from ChayimFriedman2/async-block-no-opaque
fix: Lower async block/closures correctly
2025-10-24 13:22:23 +00:00
Laurențiu Nicola
1796ced6a9
Merge pull request #20903 from A4-Tacks/update-doc-add-braces
minor: Update ide-assist docs for add_braces
2025-10-24 12:54:32 +00:00
Chayim Refael Friedman
25561d23b4
Merge pull request #20904 from ChayimFriedman2/ns3
minor: Remove no-longer-necessary conversion
2025-10-24 11:19:10 +00:00
Chayim Refael Friedman
52b62c8ec3 Remove no-longer-necessary conversion 2025-10-24 14:08:01 +03:00
A4-Tacks
6d2271696a
minor: Update ide-assist docs for add_braces 2025-10-24 18:18:57 +08:00
Chayim Refael Friedman
9b5b558f37
Merge pull request #20899 from A4-Tacks/ide-comp-test-track
minor: fix track_caller for ide-complpetion test utils
2025-10-24 05:44:37 +00:00
A4-Tacks
1a8055d777
minor: fix track_caller for ide-complpetion test utils 2025-10-24 13:34:39 +08:00
Shoyu Vanilla (Flint)
a1df998fb1
Merge pull request #20658 from A4-Tacks/more-expr-else-after-if
Fix else completion for more expressions
2025-10-24 04:27:41 +00:00
Shoyu Vanilla (Flint)
b12c794608
Merge pull request #20893 from ChayimFriedman2/specialization-ns
fix: Implement `Interner::impl_specializes()`
2025-10-24 04:23:11 +00:00
A4-Tacks
76b7c79e32
Support else completion for more expressions
- Support else completion in ArrayExpr, ReturnExpr and PrefixExpr etc
- Support else completion after MatchArm expression

Before this PR, the else branch could not be completed in most expressions

Example
---
```rust
fn foo() -> [i32; 1] {
    [if true {
        2
    } $0]
}
```
->
```rust
fn foo() -> [i32; 1] {
    [if true {
        2
    } else {
        $0
    }]
}
```

---

```rust
fn foo() -> i32 {
    match () {
        () => if true {
            2
        } $0
    }
}
```
->
```rust
fn foo() -> i32 {
    match () {
        () => if true {
            2
        } else {
            $0
        }
    }
}
```
2025-10-24 10:06:06 +08:00
Shoyu Vanilla (Flint)
2b5b7cc662
Merge pull request #20844 from A4-Tacks/add-braces-assignment
Add applicable on assignment for add_braces
2025-10-24 01:53:21 +00:00
Chayim Refael Friedman
3a47c64664 Lower async closures to TyKind::CoroutineClosure
Instead of `TyKind::Closure`.

Note: the same `InternedCoroutineId` is used both for the *async closure* as well as for the *async block it returns*. When used in `TyKind::CoroutineClosure`, it represents the closure. When used in `TyKind::Coroutine`, it represents the async block. The generic args are different, though.

Also noteworthy is that we distinguish between the different kinds of coroutines (general coroutines, async coroutines and eventually gen coroutines too) via the expression producing them (stored in the `InternedCoroutineId`). It might be worth it to introduce a `CoroutineKind` field to `InternedCoroutineId`, although this is not done in this PR.
2025-10-24 04:31:56 +03:00
Chayim Refael Friedman
c859e76f57 Represent async blocks as TyKind::Coroutine, not as opaques 2025-10-24 04:31:53 +03:00
Chayim Refael Friedman
d6d007c290
Merge pull request #20896 from smmalis37/delete-mapping
Remove hir-ty/src/next_solver/mapping.rs
2025-10-24 00:13:13 +00:00
Steven Malis
617683f8d4 Remove hir-ty/src/next_solver/mapping.rs 2025-10-23 19:18:18 -04:00
A4-Tacks
0ab44184a4
Add applicable on assignment for add_braces
```rust
fn foo() {
    let x =$0 n + 100;
}
```
->
```rust
fn foo() {
    let x = {
        n + 100
    };
}
```
2025-10-24 03:59:09 +08:00
Chayim Refael Friedman
c1ecea6d7e Implement Interner::impl_specializes()
Using specialization logic ported from rustc.
2025-10-23 20:48:51 +03:00
Chayim Refael Friedman
6e397d3cd5
Merge pull request #20889 from A4-Tacks/heuristic-field-expr
Heuristic sensing parenthesis completion of fields
2025-10-23 17:16:53 +00:00
A4-Tacks
03b8682865
Fix some typos 2025-10-24 01:06:27 +08:00
Chayim Refael Friedman
88e4ea560a
Merge pull request #20891 from daladim/semantic_type_for_logical_not
Semantic type for logical not
2025-10-23 15:46:11 +00:00
daladim
1ef688810f Updated unit tests 2025-10-23 16:58:12 +02:00
daladim
68cb0a9b3f Added the "negation" semantic token 2025-10-23 16:38:26 +02:00
A4-Tacks
c00dfa3a11
Heuristic sensing parenthesis completion of fields
We have conducted heuristic sensing on method parentheses, but it cannot complete fields

Example
---
```rust
struct Foo { far: i32 }
impl Foo {
    fn foo(&self) {}
}
fn foo() -> (i32, i32) {
    let foo = Foo { far: 4 };
    foo.f$0
    (2, 3)
}
```

**Before this PR**:

```text
me foo()  fn(&self)
...
```

**After this PR**:

```text
fd far          i32
me foo()  fn(&self)
...
```
2025-10-23 14:49:55 +08:00
Chayim Refael Friedman
3f8c2129d7
Merge pull request #20888 from ShoyuVanilla/bump-rustc-deps
internal: Bump rustc deps
2025-10-23 06:06:46 +00:00
Shoyu Vanilla (Flint)
e13aab74c9
Merge pull request #20884 from ChayimFriedman2/fix-cfg-error
fix: Fix "cannot insert `true` or `false` to cfg" error in fixtures
2025-10-23 00:11:51 +00:00
Shoyu Vanilla
9610f01c52 Port CanonicalInstantiator from rustc 2025-10-23 09:09:49 +09:00
Shoyu Vanilla
40e36a0687 Bump rustc deps 2025-10-23 08:40:18 +09:00
Chayim Refael Friedman
3cc95dfffb
Merge pull request #20887 from rust-lang/revert-20316-better-attrs
Revert "internal: Rewrite attribute handling"
2025-10-22 16:28:43 +00:00
Chayim Refael Friedman
2ae4ddbecb
Revert "internal: Rewrite attribute handling" 2025-10-22 19:19:13 +03:00
Chayim Refael Friedman
659aa56adb
Merge pull request #20316 from ChayimFriedman2/better-attrs
internal: Rewrite attribute handling
2025-10-22 12:46:19 +00:00
Lukas Wirth
e3ece38d52
Merge pull request #20886 from A4-Tacks/parse-missing-method-name
Improve parsing of missing name in MethodCallExpr
2025-10-22 10:30:55 +00:00
Chayim Refael Friedman
7773fe0fb8 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
A4-Tacks
922aad6b6d
Improve parsing of missing name in MethodCallExpr
Usually, this occurs when preparing to input a method name

However, once an identifier is entered, it is not reasonable for the parsing result to change from `CallExpr(FieldExpr())` to `MethodCallExpr()`

Example
---
```rust
fn foo() {
    x.
    ()
}
```

**Before this PR**:

```text
SOURCE_FILE
  FN
    FN_KW "fn"
    WHITESPACE " "
    NAME
      IDENT "foo"
    PARAM_LIST
      L_PAREN "("
      R_PAREN ")"
    WHITESPACE " "
    BLOCK_EXPR
      STMT_LIST
        L_CURLY "{"
        WHITESPACE "\n    "
        CALL_EXPR
          FIELD_EXPR
            PATH_EXPR
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "x"
            DOT "."
          WHITESPACE "\n    "
          ARG_LIST
            L_PAREN "("
            R_PAREN ")"
        WHITESPACE "\n"
        R_CURLY "}"
  WHITESPACE "\n"
error 17: expected field name or number
```

**After this PR**:

```text
SOURCE_FILE
  FN
    FN_KW "fn"
    WHITESPACE " "
    NAME
      IDENT "foo"
    PARAM_LIST
      L_PAREN "("
      R_PAREN ")"
    WHITESPACE " "
    BLOCK_EXPR
      STMT_LIST
        L_CURLY "{"
        WHITESPACE "\n    "
        METHOD_CALL_EXPR
          PATH_EXPR
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "x"
          DOT "."
          WHITESPACE "\n    "
          ARG_LIST
            L_PAREN "("
            R_PAREN ")"
        WHITESPACE "\n"
        R_CURLY "}"
  WHITESPACE "\n"
error 17: expected method name, field name or number
```
2025-10-22 14:37:12 +08:00
Chayim Refael Friedman
1b945793ee
Merge pull request #20571 from A4-Tacks/type-kw-comp
Add type keywords completions
2025-10-22 03:52:52 +00:00
Chayim Refael Friedman
cef7df38b6
Merge pull request #20831 from A4-Tacks/record-expr-shorthand
Add shorthand field completion for record-expr
2025-10-22 03:52:27 +00:00
A4-Tacks
70e3d8ca5c
Add type keywords completions
Example
---
```
kw dyn
kw fn
kw for
kw impl
```
2025-10-22 11:35:09 +08:00
A4-Tacks
6fe555360e
Add shorthand field completion for record-expr
Example
---
```rust
struct Foo { bar: bool, n: i32 }

fn baz() {
    let bar = true;
    let foo: Foo = Fo$0;
}
```

**Before this PR**:

```rust
struct Foo { bar: bool, n: i32 }

fn baz() {
    let bar = true;
    let foo: Foo = Foo { bar: ${1:()}, n: ${2:()} }$0;
}
```

**After this PR**:

```rust
struct Foo { bar: bool, n: i32 }

fn baz() {
    let bar = true;
    let foo: Foo = Foo { bar$1, n: ${2:()} }$0;
}
```
2025-10-22 11:31:43 +08:00
Chayim Refael Friedman
db2e268314
Merge pull request #20670 from A4-Tacks/heuristic-newline-in-block-expr
Add heuristic sensing `is_in_block`
2025-10-22 03:24:24 +00:00
A4-Tacks
911edbfe81
Add heuristic sensing is_in_block
Example
---
```rust
fn foo() -> [i32; 2] {
    l$0
    [0, n]
}
```

**Before this PR**:

```text
loop~
line!(…)~ macro_rules! line
```

**After this PR**:

```text
let~
loop~
letm~
line!(…)~ macro_rules! line
```
2025-10-22 11:14:31 +08:00
Chayim Refael Friedman
f04279b06d
Merge pull request #20755 from A4-Tacks/doc-include
Add `doc = include_str!("…")` completion
2025-10-22 03:01:22 +00:00
Chayim Refael Friedman
f7a7ed8bfd
Merge pull request #20771 from A4-Tacks/else-kw-invert-if
Add applicable on `else` for invert_if
2025-10-22 02:52:22 +00:00
Chayim Refael Friedman
385bd28558 Fix "cannot insert true or false to cfg" error in fixtures 2025-10-22 05:17:27 +03:00
Chayim Refael Friedman
fe17c400de
Merge pull request #20882 from ChayimFriedman2/accurate-mem-report
internal: Clear next-solver cache before reporting memory usage in analysis-stats
2025-10-21 20:07:50 +00:00
Chayim Refael Friedman
d76463c857 Clear next-solver cache before reporting memory usage in analysis-stats
The cache shouldn't be included, as it is mostly temporary (per-revision).
2025-10-21 22:58:31 +03:00
Chayim Refael Friedman
c084f044df
Merge pull request #20554 from dpaoliello/extraenv
Improvements for resolving the value of the `env!` macro
2025-10-21 18:10:57 +00:00
Daniel Paoliello
ba61c29ce1 Allow env vars set in cargo.extraEnv to be resolved by the env! macro 2025-10-21 11:00:27 -07:00
Shoyu Vanilla (Flint)
3643535c16
Merge pull request #20850 from A4-Tacks/add-mis-match-arms-indent
Migrate `add_missing_match_arms` assist, because edit_in_place uses ted
2025-10-21 05:00:12 +00:00
Shoyu Vanilla (Flint)
d6573fde9d
Merge pull request #20880 from A4-Tacks/conv-tuple-to-named-rest-pat
Fix invalid RestPat for convert_tuple_struct_to_named_struct
2025-10-21 04:59:16 +00:00
Shoyu Vanilla (Flint)
34af63109f
Merge pull request #20872 from A4-Tacks/conv-named-to-tuple-rest-pat
Fix missing RestPat for convert_named_struct_to_tuple_struct
2025-10-21 04:54:46 +00:00
A4-Tacks
e6656c19b4
Fix invalid RestPat for convert_tuple_struct_to_named_struct
```rust
struct X$0(i8, i16, i32, i64);
fn foo(X(a, .., d): X) {}
```

**Before this PR**:

```rust
struct X { field1: i8, field2: i16, field3: i32, field4: i64 }
fn foo(X { field1: a, field2: .., field3: d }: X) {}
```

**After this PR**:

```rust
struct X { field1: i8, field2: i16, field3: i32, field4: i64 }
fn foo(X { field1: a, field4: d, .. }: X) {}
```
2025-10-21 11:52:06 +08:00