Commit graph

36089 commits

Author SHA1 Message Date
Shoyu Vanilla
4a8bc8db38 Fix failing tests and fill-in missing details 2025-09-10 01:43:22 +09:00
jackh726
d24e8c1d38 WIP switch inference table to next-solver 2025-09-09 22:45:14 +09:00
Chayim Refael Friedman
fcab4fbabb Make #[target_feature] safe always on WASM
Even when the feature isn't enabled, as it's not UB to invoke an undefined feature in WASM (just a trap).
2025-09-09 13:49:11 +03:00
Chayim Refael Friedman
6315e315ad Expand target info to include the architecture
And make it easier to expand it more in the future, if needed.
2025-09-09 13:47:26 +03:00
Chayim Refael Friedman
f91b99b471 Resolve paths to snapshot test libraries absolutely
That is, resolve them globally, not from the test's location.

This *should* result in more robust resolution; for example, previously the code failed to detect the presence of snapshot testing if the snapshot library was renamed in the dependency or was an indirect dependency.
2025-09-09 10:38:20 +03:00
Chayim Refael Friedman
6da1ce7869
Merge pull request #20624 from A4-Tacks/fix-syn-lifetime-bounds
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Fix LifetimeParam::lifetime_bounds invalid implement
2025-09-09 07:35:19 +00:00
Chayim Refael Friedman
a61c419024
Merge pull request #20638 from Kobzol/book-share-cache
Add a FAQ entry about RA and Cargo build lock/cache conflicts
2025-09-09 07:25:56 +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
Jakub Beránek
e5a51cc6c5
Add a FAQ entry about RA and Cargo interaction 2025-09-09 09:12:09 +02:00
Jakub Beránek
255f020e76
Update documentation about how to build the RA book 2025-09-09 08:37:02 +02:00
Ifeanyi Orizu
b394f5d408 Skip flycheck for workspace if it is already being checked 2025-09-08 16:13:42 -05:00
Chayim Refael Friedman
9edc9cbe5d
Merge pull request #20632 from rmehri01/navigation-on-prims
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
feat: support navigation on primitives
2025-09-08 20:12:04 +00:00
Ryan Mehri
ab44e6d504 make TryToNav take Semantics instead of RootDatabase 2025-09-08 15:59:46 -04:00
Ryan Mehri
091cc8dc47 add test 2025-09-08 14:33:25 -04:00
Ryan Mehri
535147d57f impl TryToNav for BuiltinType instead 2025-09-08 14:23:52 -04:00
Chayim Refael Friedman
de985992e3
Merge pull request #20633 from Wilfred/improve_intro
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Clarify intro in README and manual
2025-09-08 18:21:54 +00:00
Wilfred Hughes
365be20980 Clarify intro in README and manual
The first sentence a new user should see should ideally answer the
questions:

* What is rust-analyzer?
* Why might I want to use it?

The vast majority of users will be interested in using rust-analyzer
inside their favourite editor. We should clarify that rust-analyzer is
an LSP implementation and that it supports all the classic IDE
features.

Whilst it's also true that rust-analyzer is modular and organised into
libraries, the first impression should (I think) focus on an overview
and the primary use case.
2025-09-08 19:10:14 +01:00
Chayim Refael Friedman
82bf36e2cd
Merge pull request #20631 from Wilfred/remove_register_attr
Remove support for register_attr
2025-09-08 15:52:36 +00:00
Ryan Mehri
67a39886c3 feat: support navigation on primitives 2025-09-08 11:16:11 -04:00
Wilfred Hughes
bca5d59627 Remove support for register_attr
This was removed in rustc in 2022: https://github.com/rust-lang/rust/pull/101123

Closes #20525.
2025-09-08 15:56:56 +01:00
Laurențiu Nicola
a91fb2b9a1
Merge pull request #20620 from A4-Tacks/let-else-completion
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: add `else` keyword completion after `let` statements
2025-09-08 06:03:00 +00:00
Laurențiu Nicola
e0aa8d404b
Merge pull request #20626 from A4-Tacks/make-record-ws
Improve make::struct_ field_list whitespace
2025-09-08 05:52:57 +00: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
A4-Tacks
56114fc302
Add allow else keyword completion in LetStmt
Example
---
```rust
fn foo() {
    let _ = 2 el$0
}
```
->
```rust
fn foo() {
    let _ = 2 else {
        $0
    };
}
```
2025-09-06 13:09:07 +08:00
A4-Tacks
db027e057d
Fix indent for unresolved_field fixes
Examples
---
```rust
mod indent {
    struct Foo {}

    fn foo() {
        let foo = Foo{};
        foo.bar$0;
    }
}
```

**Before this PR**:

```rust
mod indent {
    struct Foo {        bar: ()
}

    fn foo() {
        let foo = Foo{};
        foo.bar;
    }
}
```

**After this PR**:

```rust
mod indent {
    struct Foo {
        bar: ()
    }

    fn foo() {
        let foo = Foo{};
        foo.bar;
    }
}
```

---
New field list add newline

```rust
mod indent {
    struct Foo;

    fn foo() {
        Foo.bar$0;
    }
}
```

**Before this PR**:

```rust
mod indent {
    struct Foo{ bar: () }

    fn foo() {
        Foo.bar;
    }
}
```

**After this PR**:

```rust
mod indent {
    struct Foo {
        bar: (),
    }

    fn foo() {
        Foo.bar;
    }
}
```
2025-09-05 15:57:51 +08:00
Shoyu Vanilla (Flint)
a53b44412d
Merge pull request #20609 from ChayimFriedman2/update-rustc
Some checks failed
metrics / build_metrics (push) Has been cancelled
rustdoc / rustdoc (push) Has been cancelled
metrics / other_metrics (diesel-1.4.8) (push) Has been cancelled
metrics / other_metrics (hyper-0.14.18) (push) Has been cancelled
metrics / other_metrics (ripgrep-13.0.0) (push) Has been cancelled
metrics / other_metrics (self) (push) Has been cancelled
metrics / other_metrics (webrender-2022) (push) Has been cancelled
metrics / generate_final_metrics (push) Has been cancelled
internal: Upgrade rustc crates
2025-09-05 03:18:14 +00:00
A4-Tacks
8f8ef0384b
Fix precedence parenthesis for replace_arith_op
Example
---
```rust
fn main() {
    let x = 1*x $0+ 2;
}
```

**Before this PR**:

```rust
fn main() {
    let x = 1*x.wrapping_add(2);
}
```

**After this PR**:

```rust
fn main() {
    let x = (1*x).wrapping_add(2);
}
```
2025-09-05 06:30:28 +08:00
Chayim Refael Friedman
b78574cd62 Upgrade rustc crates
The main changes are (there are some other small changes):

 - Using a specific type for trait IDs in the new solver, allowing us to simplify a lot of code.
 - Add `BoundConst` similar to `BoundTy` and `BoundRegion` (previously consts used `BoundVar` directly), due to a new trait requirement.
2025-09-04 22:36:31 +03:00
Chayim Refael Friedman
fa19df2d0e
Merge pull request #20607 from ChayimFriedman2/ns-dyn-mismatch
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
internal: Add a regression test for a fixed new trait solver bug
2025-09-04 09:34:45 +00:00
Chayim Refael Friedman
639db34b7b
Merge pull request #20606 from ChayimFriedman2/reborrow-config-typo
fix: Fix typo in config
2025-09-04 09:24:29 +00:00
Chayim Refael Friedman
aa2bb65417 Add a regression test for a fixed new trait solver bug
Not sure what exactly fixed it, but why not.
2025-09-04 12:18:22 +03:00
Chayim Refael Friedman
721dcdd327 Fix typo in config
To make it backwards-compatible.
2025-09-04 12:10:39 +03:00
A4-Tacks
b7a2f21d58
Add cfg_attr predicate completion
Example
---
```rust
#[cfg_attr($0, must_use)]
struct Foo;
```
2025-09-04 15:04:29 +08:00
A4-Tacks
9edd2ad251
Add applicable on bang ! for apply_demorgan
Example
---
```rust
fn f() { $0!(1 || 3 && 4 || 5) }
```
->
```rust
fn f() { !1 && !(3 && 4) && !5 }
```
2025-09-03 21:14:19 +08:00
Shoyu Vanilla (Flint)
a79e27b8d2
Merge pull request #20586 from ChayimFriedman2/placeholder-ns
Some checks failed
rustdoc / rustdoc (push) Has been cancelled
metrics / build_metrics (push) Has been cancelled
metrics / other_metrics (webrender-2022) (push) Has been cancelled
metrics / generate_final_metrics (push) Has been cancelled
metrics / other_metrics (diesel-1.4.8) (push) Has been cancelled
metrics / other_metrics (hyper-0.14.18) (push) Has been cancelled
metrics / other_metrics (ripgrep-13.0.0) (push) Has been cancelled
metrics / other_metrics (self) (push) Has been cancelled
fix: Make sense of the mess that were (are) different kind of generics in the solver
2025-09-03 06:00:29 +00:00
A4-Tacks
60153f6c52
Fix closure in match not applicable for add_braces
Example
---

**Not applicable**:

```rust
fn foo() {
    match () {
        () => {
            t(|n|$0 n + 100);
        }
    }
}
```
2025-09-03 01:18:47 +08:00
Laurențiu Nicola
ebc2465aa9
Merge pull request #20587 from ChayimFriedman2/private-inherent
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: Deduplicate methods in completion by function ID and not by name
2025-09-02 06:00:12 +00:00
Chayim Refael Friedman
8a2e845e58 Deduplicate methods in completion by function ID and not by name
Because duplicates can be found with traits. Worse, the inherent methods could be private, and we'll discover that only later. But even if they're not they're different methods, and its seems worthy to present them all to the user.
2025-09-02 08:16:36 +03:00
Chayim Refael Friedman
41611b19e5 Make sense of the mess that were (are) different kind of generics in the solver
To the extent possible.

Previously they were confused. Sometimes generic params were treated as `Param` and sometimes as `Placeholder`. A completely redundant (in the new solver) mapping of salsa::Id to ints to intern some info where we could just store it uninterned (not in Chalk though, for some weird reason).

Plus fix a cute bug in closure substitution that was caught by the assertions of Chalk but the next solver did not have such assertions. Do we need more assertions?
2025-09-02 06:39:32 +03:00
bors
0bfb1148ad Auto merge of #144783 - folkertdev:loop-match-diverging-loop, r=SparrowLii
fix `#[loop_match]` on diverging loop

tracking issue: https://github.com/rust-lang/rust/issues/132306

fixes https://github.com/rust-lang/rust/issues/144492
fixes https://github.com/rust-lang/rust/issues/144493

fixes https://github.com/rust-lang/rust/issues/144781

this generated invalid MIR before. issue https://github.com/rust-lang/rust/issues/143806 still has an issue where we assign `state = state` which is invalid in MIR. Fixing that problem is tricky, so I'd like to do that separately.

r? `@bjorn3`
2025-09-01 14:42:07 +00:00
Chayim Refael Friedman
21614ed2d3
Merge pull request #20579 from Elliot-Roberts/fix-double-target-option
Some checks failed
metrics / build_metrics (push) Has been cancelled
rustdoc / rustdoc (push) Has been cancelled
metrics / other_metrics (diesel-1.4.8) (push) Has been cancelled
metrics / other_metrics (hyper-0.14.18) (push) Has been cancelled
metrics / other_metrics (ripgrep-13.0.0) (push) Has been cancelled
metrics / other_metrics (self) (push) Has been cancelled
metrics / other_metrics (webrender-2022) (push) Has been cancelled
metrics / generate_final_metrics (push) Has been cancelled
fix: Avoid `--target` option being given twice to `rustc` when invoked through `cargo rustc` while fetching target data layout
2025-08-30 23:41:14 +00:00
Elliot Roberts
32e2b60d86 Pass --target before -- for cargo rustc 2025-08-30 13:36:29 -07:00
Shoyu Vanilla (Flint)
a271dac578
Merge pull request #20563 from ChayimFriedman2/ns-projection-dyn-auto-trait
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: When mapping next-solver's `dyn` type, add `Self` (aka. bound var ^1.0) to auto traits' substitutions
2025-08-30 13:39:33 +00:00
David Barsky
67a58fdfeb
Merge pull request #20569 from rust-lang/dependabot/cargo/tracing-subscriber-0.3.20
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Bump tracing-subscriber from 0.3.19 to 0.3.20
2025-08-29 22:56:40 +00:00
dependabot[bot]
50e746bfe4
Bump tracing-subscriber from 0.3.19 to 0.3.20
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.3.19 to 0.3.20.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.19...tracing-subscriber-0.3.20)

---
updated-dependencies:
- dependency-name: tracing-subscriber
  dependency-version: 0.3.20
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-29 20:55:43 +00:00
Lukas Wirth
dd7c7ae44c
Merge pull request #20560 from ChayimFriedman2/analysis-stats-improve
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: Add progress bars to more places in analysis-stats
2025-08-29 07:30:59 +00:00
Chayim Refael Friedman
867af5fbb6 When mapping next-solver's dyn type, add Self (aka. bound var ^1.0) to auto traits' substitutions
Chalk represents dyn types as a list of predicate, the self type should be there. The next solver represents them quite differently. The `Self` was forgotten for the auto trait case.
2025-08-28 23:53:55 +03:00
Chayim Refael Friedman
6e59defe11
Merge pull request #20561 from ChayimFriedman2/no-table-for-you
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
minor: Don't require a full `InferenceTable` for `CastTy`
2025-08-28 16:38:39 +00:00
Chayim Refael Friedman
ff06610625 Don't require a full InferenceTable for CastTy
A DB is enough.
2025-08-28 19:24:46 +03:00
Chayim Refael Friedman
7af77c5af1 Add progress bars to more places in analysis-stats
Namely, mir lowering, const eval and IDE things.
2025-08-28 18:54:46 +03:00