36004 Commits

Author SHA1 Message Date
Chayim Refael Friedman
6b133c6b1b Implement fallback properly
fallback.rs was ported straight from rustc (minus the lint parts).

This fixes the `!` regressions.
2025-09-24 20:42:06 +03:00
Chayim Refael Friedman
993db83afd
Merge pull request #20683 from regexident/inference-result-types-iter
Expose iterators over an inference result's types
2025-09-24 17:12:33 +00:00
Shoyu Vanilla (Flint)
4d4a1dd464
Merge pull request #20733 from jackh726/next-trait-solver-next3
Convert more things from chalk to next solver
2025-09-24 04:52:28 +00:00
Jack Huey
7a6df720c4 Be sure to instantiate and pass up trait refs in named_associated_type_shorthand_candidates 2025-09-23 16:27:04 -04:00
Jack Huey
ea48563951 Remove all non-ns diagnostics queries, naming consistenly 2025-09-23 16:27:03 -04:00
Jack Huey
cc7c061e34 Use lower_nextsolver::callable_item_signature instead of lower::callable_item_signature 2025-09-23 16:26:46 -04:00
Shoyu Vanilla (Flint)
905641f352
Merge pull request #20543 from sgasho/fix/19443_replace_match_with_if_let
Fix "Replace match with if let" not to trigger when invalid transformations occur
nightly
2025-09-23 09:46:37 +00:00
Vincent Esche
7e9abceee7 Expose iterators over an inference result's types
(This re-introduces a reduced access to a couple of previously public fields on `InferenceResult`)
2025-09-23 11:39:40 +02:00
Jack Huey
73a401301d Remove lower::value_ty in favor of lower_nextsolver::value_ty 2025-09-23 03:58:51 -04:00
Jack Huey
3089d23710 Remove lower::ty in favor of lower_nextsolver::ty 2025-09-23 03:58:51 -04:00
Shoyu Vanilla (Flint)
f6cf3035c3
Merge pull request #20730 from A4-Tacks/migrate-expand-rest-pat
Migrate `expand_record_rest_pattern` assist to use `SyntaxEditor`
2025-09-23 07:05:22 +00:00
Shoyu Vanilla (Flint)
7804a2dd67
Merge pull request #20728 from jackh726/next-trait-solver-next2
Use ParamEnv in TraitEnvironment
2025-09-23 07:01:45 +00:00
A4-Tacks
258776b63a
Migrate expand_record_rest_pattern assist to use SyntaxEditor
Because `add_field` uses `ted`
2025-09-23 12:14:14 +08:00
Jack Huey
34f773f596 Use ParamEnv in TraitEnvironment 2025-09-23 00:04:57 +00:00
Jack Huey
c2513538cd Add 'db to TraitEnvironment 2025-09-23 00:04:57 +00:00
jackh726
7b9ad945ec Make Field::ty return TypeNs 2025-09-23 00:04:56 +00:00
jackh726
839645b4de Use ns versions of with_diagnostics queries 2025-09-22 21:50:12 +00:00
Shoyu Vanilla (Flint)
d05355db16
Merge pull request #20592 from A4-Tacks/add-braces-closure-in-match
Fix closure in match not applicable for add_braces
2025-09-22 15:51:12 +00:00
Shoyu Vanilla (Flint)
c1499a2381
Merge pull request #20679 from A4-Tacks/no-comp-ty-in-nested-pat
Fix complete type in nested pattern
2025-09-22 15:37:39 +00:00
Shoyu Vanilla (Flint)
d6e14cc457
Merge pull request #20722 from A4-Tacks/pull-assign-up-inner-if
Fix apply in inner if for pull_assignment_up
2025-09-22 15:31:10 +00:00
Shoyu Vanilla (Flint)
b465ae054a
Merge pull request #20723 from A4-Tacks/fix-bind-unused-applicable-underscore
Fix applicable on underscore for bind_unused_param
2025-09-22 15:29:47 +00:00
Shoyu Vanilla (Flint)
3249fc76b2
Merge pull request #20725 from ChayimFriedman2/fix-missing-lifetime
fix: Fix lifetime elision handling for `Fn`-style trait bounds
2025-09-22 15:21:19 +00:00
Chayim Refael Friedman
7d9af9f6a5
Merge pull request #20717 from ShoyuVanilla/migrate-more
internal: Migrate more predicate things to next-solver
2025-09-22 14:55:32 +00:00
Shoyu Vanilla
0a5457a392 internal: Migrate more predicate things to next-solver 2025-09-22 23:44:50 +09:00
Chayim Refael Friedman
ad9422da1a Fix lifetime elision handling for Fn-style trait bounds
Two fixes were needed:

 1. Previously, we enabled elision for the generic args of `Fn` itself, instead of for generic args of paths within it.
 2. In lowering in the new solver the `Output` parameter did not have elision set correctly, I don't know why. In the old lowering it was done correctly.
2025-09-22 16:53:20 +03:00
Chayim Refael Friedman
83981c14aa
Merge pull request #20724 from ChayimFriedman2/ns-cleanup3
minor: Another regression test for next solver fixed bug
2025-09-22 07:36:56 +00:00
Chayim Refael Friedman
d5f597e726 Another regression test for next solver fixed bug 2025-09-22 10:26:03 +03:00
A4-Tacks
fef1ab5d71
Fix applicable on underscore for bind_unused_param
Fixes:
- applicable on underscore prefix parameter
- using binding mode as an expression

Examples
---
```rust
fn foo($0_x: i32, y: i32) {}
```

**Before this PR**:

```rust
fn foo(_x: i32, y: i32) {
    let _ = _x;
}
```

**After this PR**:

Assist not applicable

---

```rust
fn foo(ref $0y: i32) {}
```

**Before this PR**:

```rust
fn foo(ref y: i32) {
    let _ = ref y;
}
```

**After this PR**:

```rust
fn foo(ref y: i32) {
    let _ = y;
}
```
2025-09-22 15:13:13 +08:00
A4-Tacks
23535a6646
Fix apply in internal if for pull_assignment_up
Example
---
```rust
fn foo() {
    let mut a = 1;

    if true {
        a = 2;
    } else if true {
        $0a = 3;
    } else {
        a = 4;
    }
}
```

**Before this PR**:

```rust
fn foo() {
    let mut a = 1;

    if true {
        a = 2;
    } else a = if true {
        3
    } else {
        4
    };
}
```

**After this PR**:

```rust
fn foo() {
    let mut a = 1;

    a = if true {
        2
    } else if true {
        3
    } else {
        4
    };
}
```
2025-09-22 14:32:46 +08:00
Chayim Refael Friedman
f41f762a80
Merge pull request #20718 from ChayimFriedman2/inlay-max-len-docs
minor: Clarify `rust-analyzer.inlayHints.maxLength` is not a hard guarantee
2025-09-22 01:27:15 +00:00
Chayim Refael Friedman
129d9f7af6 Clarify rust-analyzer.inlayHints.maxLength is not a hard guarantee 2025-09-22 04:16:50 +03:00
Shoyu Vanilla (Flint)
e7d7cb415a
Merge pull request #20714 from A4-Tacks/rm-dbg-trailing-comma
Fix not applicable on trailing comma for remove_dbg
2025-09-21 06:48:17 +00:00
A4-Tacks
168ca55a99
Fix not applicable on trailing comma for remove_dbg
`remove_dbg` not applicable for whitespaces after trailing comma

Example
---
```rust
fn foo() {
    dbg!(
        bar(),
    );
}
```

**Before this PR**:

Assist not applicable

**After this PR**:

```rust
fn foo() {
    bar();
}
```
2025-09-21 11:05:10 +08:00
Shoyu Vanilla (Flint)
187917fa5d
Merge pull request #20706 from A4-Tacks/stdx-replace-inplace
Fix to implements in-place stdx::replace
2025-09-20 13:32:39 +00:00
A4-Tacks
29de96c4e0
Add some test for stdx::replace 2025-09-20 21:15:12 +08:00
Shoyu Vanilla (Flint)
a003d4d127
Merge pull request #20661 from A4-Tacks/suggest-if-body
Fix IfExpr branches suggests
2025-09-20 13:08:01 +00:00
A4-Tacks
48dc150f31
Fix to implements in-place stdx::replace 2025-09-20 20:58:44 +08:00
A4-Tacks
07f33e2b81
Fix IfExpr then branch suggest
- And add logic operation suggest

Example
---
In the old implementation, it always suggested conditions,
this is a lot of noise, e.g `contract_checks()~(use std::intrinsics::contract_checks) const fn() -> bool`

```rust
fn foo() {
    if true {
        c$0
    }
}
```
2025-09-20 20:56:27 +08:00
Shoyu Vanilla (Flint)
3705f71df9
Merge pull request #20710 from A4-Tacks/unused-var-shorthand
Fix unused_variables fixes shorthand record field
2025-09-20 12:54:34 +00:00
Shoyu Vanilla (Flint)
6d5bfaee6a
Merge pull request #20709 from A4-Tacks/destruct-panic-on-not-add-deref-and-paren
Fix panic `!self.data().mutable` for destructure_struct_binding
2025-09-20 12:41:21 +00:00
Shoyu Vanilla (Flint)
da47c3da45
Merge pull request #20686 from A4-Tacks/gen-default-not-apply-selected
Fix selected applicable generate_default_from_enum_variant
2025-09-20 12:40:50 +00:00
David Barsky
a196eba3eb
Merge pull request #20689 from ShoyuVanilla/accurate-flycheck
fix: Make flycheck clearing dependency-aware
2025-09-20 12:33:39 +00:00
A4-Tacks
d6c66dff1d
Fix selected multi variants applicable generate_default_from_enum_variant 2025-09-20 20:29:02 +08:00
Shoyu Vanilla (Flint)
259a01d73d
Merge pull request #20688 from A4-Tacks/fix-applicable-after-l-curly-replace-is-method-with-if-let
Fix applicable after l_curly for replace_is_method_with_if_let_method
2025-09-20 12:06:18 +00:00
Shoyu Vanilla (Flint)
84bb4051bf
Merge pull request #20700 from A4-Tacks/extract-var-let-expr
Fix extract_variable on LetExpr
2025-09-20 11:59:20 +00:00
Shoyu Vanilla (Flint)
a943034d68
Merge pull request #20702 from A4-Tacks/else-not-before-else
Fix `else` completion before else keyword
2025-09-20 11:57:07 +00:00
Shoyu Vanilla (Flint)
81ea457fc5
Merge pull request #20708 from A4-Tacks/destruct-ref-mut-panics
Fix panics on `Foo{mut x}` for destructure_struct_binding
2025-09-20 11:54:47 +00:00
A4-Tacks
a41ca500b0
Fix unused_variables fixes shorthand record field
Example
---

```rust
struct S { field : u32 }
fn main() {
    let s = S { field : 2 };
    let S { $0field } = s
}
```

**Before this PR**:

```rust
struct S { field : u32 }
fn main() {
    let s = S { field : 2 };
    let S { _field } = s
}
```

**After this PR**:

```rust
struct S { field : u32 }
fn main() {
    let s = S { field : 2 };
    let S { field: _field } = s
}
```
2025-09-20 18:25:28 +08:00
A4-Tacks
f34e9ca8d3
Fix panic !self.data().mutable for destructure_struct_binding
When the reference type does not require adding a dereference or parentheses, it will panic

Example
---

```rust
struct Foo { bar: i32, baz: i32 }

fn main() {
    let $0foo = &Foo { bar: 1, baz: 2 };
    let _ = &foo.bar;
}
```

**Before this PR**:

Panic:
```
assertion failed: !self.data().mutable
```

**After this PR**:

```rust
struct Foo { bar: i32, baz: i32 }

fn main() {
    let Foo { bar, baz } = &Foo { bar: 1, baz: 2 };
    let _ = bar;
}
```
2025-09-20 17:52:01 +08:00
A4-Tacks
d4731ad9e2
Fix panics on Foo{mut x} for destructure_struct_binding
Example
---
```rust
struct Foo { x: () }
struct Bar { foo: Foo }
fn f(Bar { mut $0foo }: Bar) {}
```

**Before this PR**:

Panic `Option::unwrap`

**After this PR**:

```rust
struct Foo { x: () }
struct Bar { foo: Foo }
fn f(Bar { foo: Foo { mut x } }: Bar) {}
```
2025-09-20 16:14:51 +08:00