Commit graph

30629 commits

Author SHA1 Message Date
Liao Junxuan
35b4957b80
feat: add inlay hints for generic parameters
fixes #11091

By default, only hints for const generic parameters are shown.
2024-07-08 19:11:41 +08:00
bors
a5b21ea0aa Auto merge of #17555 - Veykril:grammar-inline, r=Veykril
internal: Inline generated syntax methods
2024-07-07 09:21:04 +00:00
Lukas Wirth
35aa238020 Inline all the things 2024-07-07 11:18:40 +02:00
Lukas Wirth
c08d419fba HasGenericArgs syntax trait 2024-07-07 11:18:28 +02:00
bors
a494aaba87 Auto merge of #17523 - wada314:master, r=Veykril
Add an option to use "::" for the external crate prefix.

Fixes #11823 .
Hi I'm very new to rust-analyzer and not sure how the review process are. Can somebody take a look at this PR? thanks!
2024-07-07 08:32:46 +00:00
bors
0c61ffdb0e Auto merge of #17554 - Veykril:lsp-violation, r=Veykril
fix: Fix callHierarchy LSP violation

Fixes https://github.com/rust-lang/rust-analyzer/issues/14839
2024-07-07 08:16:23 +00:00
Lukas Wirth
6c8c49b01b fix: Fix callHierarchy LSP violation 2024-07-07 10:14:47 +02:00
bors
3a56aa4508 Auto merge of #17553 - Veykril:simplify-profile, r=Veykril
Move remaining codegen things to `xtask codegen`
2024-07-07 07:25:30 +00:00
Lukas Wirth
8a4b1fd96e Fix stale reference in architecture.md 2024-07-07 09:19:09 +02:00
Lukas Wirth
ce5046be50 Run codegen commands as tests if their results are commited 2024-07-07 09:14:50 +02:00
Lukas Wirth
866102cdaf Re-implement tidy as an xtask action 2024-07-07 09:12:16 +02:00
Lukas Wirth
e752517814 re-generate feature docs in release 2024-07-07 09:01:35 +02:00
Lukas Wirth
210b748909 Drop sourcegen 2024-07-07 09:00:19 +02:00
Lukas Wirth
986b9cf022 Move feature-doc generation to xtask codegen 2024-07-07 09:00:18 +02:00
Lukas Wirth
09932d9cd4 Update hover test fixture 2024-07-07 08:55:10 +02:00
Lukas Wirth
5802643900 Move parser test generation to xtask 2024-07-07 08:51:19 +02:00
Lukas Wirth
b9c1c42959 Allow new clippy lint in test 2024-07-07 08:41:41 +02:00
Lukas Wirth
15973f1a55 Fix stop_watch on linux 2024-07-07 08:40:41 +02:00
Lukas Wirth
9b3e912d67 Update generated lint definitions 2024-07-07 08:35:18 +02:00
Lukas Wirth
90682c393d Drop unused profile things 2024-07-07 08:24:10 +02:00
bors
69523cc8b8 Auto merge of #17552 - Veykril:fn-param-comp-fix, r=Veykril
fix: Fix parameter completions using macro expanded source ranges

Fixes https://github.com/rust-lang/rust-analyzer/issues/17550
2024-07-07 06:12:47 +00:00
Lukas Wirth
8f2704654c fix: Fix parameter completions using macro expanded source ranges 2024-07-07 08:11:16 +02:00
bors
8c2adec32c Auto merge of #17527 - Veykril:caps-config, r=Veykril
internal: Move capability querying out of the config module
2024-07-07 05:56:55 +00:00
Lukas Wirth
e4604c69ba Move capability querying out of the config module 2024-07-07 07:42:12 +02:00
bors
058c88da66 Auto merge of #17551 - Veykril:has-errors, r=Veykril
Also mark InferenceResult::has_errors flag when there are error types

Should work around https://github.com/rust-lang/rust-analyzer/issues/15090#issuecomment-2211647133
2024-07-06 18:56:23 +00:00
Lukas Wirth
e0105c473e Also mark InferenceResult::has_errors flag when there are error types 2024-07-06 20:45:23 +02:00
bors
1adb52cde6 Auto merge of #17549 - Veykril:runnables-fix, r=Veykril
fix: Fix runnables being incorrectly constructed

I've misunderstood parts of the code here which caused runnables to arbitrarily break :) (I have yet to understand the conditions that made them break though, there is some odd caching involved I feel like ...)
Fixes https://github.com/rust-lang/rust-analyzer/issues/17402
2024-07-06 18:24:30 +00:00
Lukas Wirth
bb9678ea3b fix: Fix runnables being incorrectly constructed 2024-07-06 20:23:14 +02:00
bors
c888c0f109 Auto merge of #17548 - Veykril:debug-fix, r=Veykril
fix: Fix passing `message-format` after -- in debugging

Fixes https://github.com/rust-lang/rust-analyzer/pull/17495#issuecomment-2211717224
2024-07-06 16:04:53 +00:00
Lukas Wirth
7733403056 Fix passing message-format after -- in debugging 2024-07-06 18:03:33 +02:00
bors
35db3f5a03 Auto merge of #17547 - Veykril:runnables-env, r=Veykril
internal: Clean up runnable lsp extension

This feels like a natural addition to me, and also allows us to drop the expect-test hardcoding from the extension. Additionally, `cargoExtraArgs` is pointless, all the client will do is merge it with `cargoArgs` so the server can do that instead of delegating that to the client.
2024-07-06 15:02:41 +00:00
Lukas Wirth
8f69d98214 Don't emit current dir as cwd for runnables 2024-07-06 16:44:57 +02:00
Lukas Wirth
3d7ee9b4ea Flatten cargoExtraArgs away from the runnable lsp extension 2024-07-06 16:36:27 +02:00
Lukas Wirth
fcddcf2ee5 Add environment to runnable lsp extension 2024-07-06 16:20:25 +02:00
bors
78d5f05e70 Auto merge of #17508 - jjoeldaniel:landing-page, r=Veykril
feat: Add landing/faq walkthrough pages

This is a basic implementation of a landing and FAQ page; I've included the bare-bones information as well as a [recommended section on inlay hints](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Landing.20Page/near/446135321).

I've also added `rust-analyzer: Open Walkthrough` and `rust-analyzer: Open FAQ` commands for ease of access.

I am hoping to create a small list of FAQ to include that might be useful as well as any other information I may have missed in the landing page. Feel free to share any suggestions!

![landing/faq page demo](https://github.com/rust-lang/rust-analyzer/assets/100006388/4644e4f0-4555-4b29-83c1-b048084ad63d)

cc #13351
2024-07-06 13:59:36 +00:00
bors
39d7962c69 Auto merge of #17546 - Veykril:unresolved-self, r=Veykril
internal: Diagnose unresolved self value in path expression
2024-07-06 13:46:01 +00:00
Lukas Wirth
4420e7148f Diagnose unresolved self value in path expression 2024-07-06 15:44:12 +02:00
bors
f2afcb874e Auto merge of #17541 - ShoyuVanilla:nested-impl-traits, r=Veykril
Disallow nested impl traits

Fixes #17498

The above issue is due to formatting self referencing, recursive bound like `Implemented(^0.0: TraitId(0)<[?0 := ^0.0]>)` on the codes like;

```rust
trait Foo<T> {}

trait Bar {}

fn test(foo: impl Foo<impl Bar>) { ... }
```

When lowering predicate `impl Foo<impl Bar>` in `trait_environment_query`, the outer `impl Foo<...>` is treated as predicates, so the first `TypeRef` that passes the following code is `impl Bar`;

cae997e338/crates/hir-ty/src/lower.rs (L376-L400)

and thus the `idx` is `0` in the above context.

But the following code sets `self_ty` as the `BoundVar` with `idx = 0` because the target param id for predicate  `impl Foo<...>` is `0` since `impl Foo` is the first generic-like parameter of `fn test`;

cae997e338/crates/hir-ty/src/lower.rs (L998-L1025)

For the codes like;

```rust
trait Foo {
    type Assoc;
}

trait Bar {}

fn test(foo: impl Foo<Assoc = impl Bar>) { ... }
```

similar recursive bound doesn't happen because the following codes ***"count the number of `impl Trait` things that appear before the target of our `bound`."***

cae997e338/crates/hir-ty/src/lower.rs (L1168-L1199)

Instead of doing similar thing like nested `impl Foo<impl Bar>` thing, this PR lowers such nested impl traits into error types in the similar manner as the rustc does in the following lines (and of course, allows lowering and inferencing nested impl traits for the cases that rustc permits);

- e2cf31a614/compiler/rustc_ast_passes/src/ast_validation.rs (L802-L813)
- 7b21c18fe4/compiler/rustc_ast_passes/src/ast_validation.rs (L1299-L1314)

(Though rustc emits [E0666😈](https://doc.rust-lang.org/error_codes/E0666.html), I skipped diagnostics since gathering diagnostics in `hir-def` has no conventions so far 😅)
2024-07-05 10:28:30 +00:00
Shoyu Vanilla
4bb623decb Disallow nested impl traits 2024-07-04 23:31:55 +09:00
bors
cae997e338 Auto merge of #17536 - Veykril:syntax-diags, r=Veykril
fix: Don't emit semantic diagnostics in files with a lot of syntax errors

These will only add to the noise when something very unexpected breaks or where parser recovery fails to kick in.
2024-07-03 09:01:48 +00:00
Lukas Wirth
cbcb9779f5 fix: Don't emit semantic diagnostics in files with a lot of syntax errors 2024-07-03 10:59:46 +02:00
bors
39e6a8ea36 Auto merge of #17535 - Veykril:macro-def-syn, r=Veykril
fix: Fix up the syntax tree for macro 2.0

Fixes https://github.com/rust-lang/rust-analyzer/issues/10266

This change is trivial now that we don't have a token map anymore
2024-07-03 08:46:16 +00:00
Lukas Wirth
013b6a883f Fix up the syntax tree for macro 2.0 2024-07-03 10:41:19 +02:00
bors
848e0c4040 Auto merge of #17534 - Veykril:skip-unknown-match-check, r=Veykril
fix: Skip match exhaustiveness checking if pattern type contains errors

Should fix https://github.com/rust-lang/rust-analyzer/issues/17509, checking when errors are involved is generally a bad idea as the algorithm doesn't really expect error types in the first place I believe
2024-07-03 06:34:39 +00:00
Lukas Wirth
26c7bfd0b4 Skip match exhaustiveness checking if pattern type contains errors 2024-07-03 08:31:40 +02:00
bors
4981f00bb6 Auto merge of #17530 - Veykril:lifetime-order, r=Veykril
Move lifetimes in front of type and const params but after self
2024-07-02 12:20:54 +00:00
Lukas Wirth
baa959fa99 Move lifetimes in front of type and const params but after self 2024-07-02 14:17:34 +02:00
Lukas Wirth
966798b7ba Make GenericParams::lifetimes private 2024-07-02 13:45:53 +02:00
Lukas Wirth
be1ea4028b Make GenericParams::where_predicates private 2024-07-02 13:45:50 +02:00
Lukas Wirth
372e2d22e6 Make GenericParams::type_or_consts private 2024-07-02 13:45:48 +02:00