Commit Graph

24527 Commits

Author SHA1 Message Date
Lukas Wirth
39e86e78c3 Bump Cargo.lock 2023-03-25 15:12:39 +01:00
bors
6d7511938a Auto merge of #14382 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2023-03-20 13:53:17 +00:00
Laurențiu Nicola
f07f17b146 Merge branch 'master' into sync-from-rust 2023-03-20 15:52:30 +02:00
Laurențiu Nicola
dbf04a5ee2 ⬆️ rust-analyzer 2023-03-20 08:31:01 +02:00
bors
825833c269 Auto merge of #14378 - lowr:patch/bump-chalk-0.89, r=lnicola
internal: Bump chalk

This release fixes a problem around GATs (rust-lang/chalk#790). While a regression test is added in chalk's own test suite, I also added one in ours so that we can catch regressions when we move away from chalk.

Fixes #14164
2023-03-19 08:11:09 +00:00
Ryo Yoshida
e12460bbca
Add regression test
so that we can catch regressions when we move away from chalk.
2023-03-19 16:58:10 +09:00
Ryo Yoshida
1d1a86f350
Bump chalk to 0.89 2023-03-19 16:45:26 +09:00
bors
7c05f55f0c Auto merge of #13789 - feniljain:fix_enum_completion, r=Veykril
feat: show only missing variant suggestion for enums in patterns completion and bump them in list too

Fixes #12438

### Points to help in review:

- This PR can be reviewed commit wise, first commit is about bumping enum variant completions up in the list of completions and second commit is about only showing enum variants which are not complete
- I am calculating missing variants in analysis.rs by firstly locating the enum and then comparing each of it's variant's name and checking if arm string already contains that name, this is kinda hacky but I didn't want to implement complete missing_arms assist here as that would have been too bulky to run on each completion cycle ( if we can improve this somehow would appreciate some inputs on it )

### Output:

https://user-images.githubusercontent.com/49019259/208245540-57d7321b-b275-477e-bef0-b3a1ff8b7040.mov

Relevant Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Issue.20.2312438
2023-03-18 07:06:27 +00:00
feniljain
a79a76a942 refactor: pass is_variant_missing as args to build_completion 2023-03-18 11:46:22 +05:30
feniljain
f7113685b5 fix: make tests valid rust code 2023-03-18 11:43:45 +05:30
feniljain
6778d1a6eb feat: do not remove other variants, just push them down in list 2023-03-16 22:54:12 +05:30
bors
924d277f32 Auto merge of #14361 - Veykril:if-then-parse, r=Veykril
fix: Fix `ast::IfExpr` child accessors

Fixes https://github.com/rust-lang/rust-analyzer/issues/14360
2023-03-15 14:02:16 +00:00
bors
8330f8efc6 Auto merge of #12958 - zachs18:async_closure, r=Veykril
fix: Fix return type of async closures.

May fix #12957
2023-03-15 13:35:44 +00:00
Lukas Wirth
9fe206956f fix: Fix ast::IfExpr child accessors 2023-03-15 14:34:31 +01:00
bors
c16f051792 Auto merge of #14362 - Veykril:remove-dbg, r=Veykril
internal: Prioritize remove-dbg assist over inline-macro
2023-03-15 13:20:18 +00:00
Lukas Wirth
802d7ea335 internal: Prioritize remove-dbg assist over inline-macro 2023-03-15 14:19:50 +01:00
Lukas Wirth
3bf07a5f04 Simplify 2023-03-15 13:54:06 +01:00
Zachary S
af175ddcdc Add test for async closure types.
(rebased onto 6dfd8ae)
2023-03-15 13:10:35 +01:00
Zachary S
6746a08b44 fix: Fix return type of async closures.
(rebased onto 6dfd8ae)
2023-03-15 13:10:00 +01:00
bors
adbda94303 Auto merge of #14359 - Veykril:opt-out-retry, r=Veykril
fix: Do not retry inlay hint requests

Should close https://github.com/rust-lang/rust-analyzer/issues/13372, retrying the way its currently implemented is not ideal as we do not adjust offsets in the requests, but doing that is a major PITA, so this should at least work around one of the more annoying issues stemming from it.
2023-03-15 11:44:29 +00:00
Lukas Wirth
74e08cb60d fix: Do not retry inlay hint requests 2023-03-15 12:44:11 +01:00
bors
1787c14e72 Auto merge of #14358 - Veykril:err-reporting, r=Veykril
Report sysroot and rustc crate loading errors

Also aggregates the warnings and errors so we don't discard previous ones.
cc https://github.com/rust-lang/rust-analyzer/issues/14327
2023-03-15 10:36:50 +00:00
Lukas Wirth
d9c7d28e0d Report sysroot and rustc crate loading errors 2023-03-15 11:35:34 +01:00
Lukas Wirth
e2ab0ff124 Aggregate errors and warnings in the status message 2023-03-15 11:28:37 +01:00
bors
579797f0ec Auto merge of #14357 - Veykril:rustc-priv, r=Veykril
fix: Don't pass feature flags to rustc private crates metadata invocation

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

Better error reporting I'll do in a follow up
2023-03-15 10:00:23 +00:00
Lukas Wirth
8b8cd04825 fix: Don't pass feature flags to rustc private crates metadata invocation 2023-03-15 10:52:50 +01:00
bors
e611fbe6ab Auto merge of #14355 - Veykril:completion-ref-strip, r=Veykril
fix: Fix reference completions being emitted in places other than argument lists

Fixes https://github.com/rust-lang/rust-analyzer/issues/14331
2023-03-15 09:47:20 +00:00
Lukas Wirth
82ed68c95e fix: Fix reference completions being emitted in places other than argument lists 2023-03-15 10:41:17 +01:00
bors
1a318965fe Auto merge of #14353 - lowr:fix/inline-call-bad-ast, r=Veykril
fix: don't replace `SyntaxToken` with `SyntaxNode`

Fixes #14339

When we inline method calls, we replace the `self` parameter with a local variable `this`. We have been replacing the `self` **tokens** with `NameRef` **nodes**, which makes the AST malformed. This leads to crash when we apply path transformation after the replacement (which only takes place when the method is generic and such scenario was not tested).
2023-03-15 09:32:34 +00:00
bors
05f95cbb0c Auto merge of #14354 - Veykril:sighelp, r=Veykril
feat: Add signature help for record and tuple struct patterns
2023-03-15 09:19:13 +00:00
Lukas Wirth
55120b3d83 Add signature help for tuple struct patterns 2023-03-15 10:17:30 +01:00
Ryo Yoshida
01bf0725b1
fix: don't replace SyntaxToken with SyntaxNode 2023-03-15 17:18:09 +09:00
bors
60548db111 Auto merge of #14281 - XFFXFF:fix_missing_unsafe, r=Veykril
feat: add an autofix for inserting an unsafe block to missing unsafe diagnostic

close #14241
2023-03-15 07:00:38 +00:00
feniljain
d03c789798 chore: change casing for variants in tests 2023-03-15 10:11:43 +05:30
XFFXFF
0c935732bc do not offer fixit for macro expansions and refactor the code 2023-03-15 09:12:40 +08:00
XFFXFF
bf0322cd0c pick the best ancestor expr of unsafe expr to add unsafe block. Thanks! @Veykril 2023-03-15 09:07:11 +08:00
XFFXFF
82780d8caf feat: add an autofix for inserting an unsafe block to missing unsafe diagnostic 2023-03-15 09:07:11 +08:00
Lukas Wirth
03a6ab0b62 Add signature help for record struct patterns 2023-03-14 21:55:03 +01:00
bors
b4d7ea0692 Auto merge of #13994 - Veykril:incoherent-impl, r=Veykril
lint incoherent inherent impls
2023-03-14 19:57:01 +00:00
Lukas Wirth
510e4b4029 Simplify 2023-03-14 20:22:11 +01:00
Lukas Wirth
610a94c421 Add fundamental attributes to data 2023-03-14 20:16:41 +01:00
Lukas Wirth
2c364f6e5a Fix tests 2023-03-14 19:55:20 +01:00
Lukas Wirth
f34b2469bd lint incoherent inherent impls 2023-03-14 19:20:44 +01:00
bors
c15335c8b0 Auto merge of #14307 - davidbarsky:davidbarsky/add-cargo-style-project-discovery-for-buck-and-bazel-sickos, r=Veykril
Add Cargo-style project discovery for Buck and Bazel Users

This feature requires the user to add a command that generates a `rust-project.json` from a set of files. Project discovery can be invoked in two ways:

1. At extension activation time, which includes the generated `rust-project.json` as part of the linkedProjects argument in `InitializeParams`.
2. Through a new command titled "rust-analyzer: Add current file to workspace", which makes use of a new, rust-analyzer-specific LSP request that adds the workspace without erasing any existing workspaces. Note that there is no mechanism to _remove_ workspaces other than "quit the rust-analyzer server".

Few notes:
-  I think that the command-running functionality _could_ merit being placed into its own extension (and expose it via extension contribution points) to provide build-system idiomatic progress reporting and status handling, but I haven't (yet) made an extension that does this nor does Buck expose this sort of functionality.
-  This approach would _just work_ for Bazel. I'll try and get the tool that's responsible for Buck integration open-sourced soon.
- On the testing side of things, I've used this in around my employer's Buck-powered monorepo and it's a nice experience. That being said, I can't think of an open-source repository where this can be tested in public, so you might need to trust me on this one.

I'd love to get feedback on:
- Naming of LSP extensions/new commands. I'm not too pleased with how "rust-analyzer: Add current file to workspace" is named, in that it's creating a _new_ workspace. I think that this command being added should be gated on `rust-analyzer.discoverProjectCommand` on being set, so I can add this in sequent commits.
- My Typescript. It's not particularly good.
- Suggestions on handling folders with _both_ Cargo and non-Cargo build systems and if I make activation a bit better.

(I previously tried to add this functionality entirely within rust-analyzer-the-LSP server itself, but matklad was right—an extension side approach is much, much easier.)
2023-03-14 17:48:49 +00:00
David Barsky
6e7bc07cdf fix: don't override linkedProjects if no workspace was discovered. 2023-03-14 13:36:21 -04:00
David Barsky
bd545a1c10 Address review comments 2023-03-14 12:49:35 -04:00
bors
ad91622d11 Auto merge of #14338 - Veykril:inlay-adjust, r=Veykril
fix: Only skip adjustment hints for block, if and match expressions for reborrows

cc https://github.com/rust-lang/rust-analyzer/pull/13749
2023-03-14 14:16:51 +00:00
bors
74303a3774 Auto merge of #14349 - Veykril:vis-res, r=Veykril
fix: Fix visibility resolution not respecting parent blocks

Fixes https://github.com/rust-lang/rust-analyzer/issues/14047
2023-03-14 12:43:11 +00:00
Lukas Wirth
1a9fbf0a6d fix: Fix visibility resolution not respecting parent blocks 2023-03-14 13:42:08 +01:00
bors
6f297b9076 Auto merge of #14348 - Veykril:rustc-proc, r=Veykril
fix: Fix rustc proc-macro handling being broken on the rustc workspace itself

Also addresses https://github.com/rust-lang/rust-analyzer/issues/13591#issuecomment-1466966952
2023-03-14 10:34:23 +00:00