Commit Graph

24771 Commits

Author SHA1 Message Date
hkalbasi
a063f000ff Support function pointer MIR lowering 2023-03-17 13:08:35 +03:30
hkalbasi
1b85b43e6f add mir-stats to analysis-stats 2023-03-17 13:08:35 +03:30
hkalbasi
b7b9ae59a0 desugar ? operator 2023-03-17 13:08:35 +03:30
feniljain
6778d1a6eb feat: do not remove other variants, just push them down in list 2023-03-16 22:54:12 +05:30
Lukas Wirth
66636939a6 feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects 2023-03-16 16:26:19 +01:00
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
Lukas Wirth
88f0fe784f fix: Fix rustc proc-macro handling being broken on the rustc workspace itself 2023-03-14 11:33:40 +01:00
bors
6a98e961f8 Auto merge of #14340 - Veykril:expand, r=lnicola
internal: Rename AstDatabase to ExpandDatabase
2023-03-14 09:37:54 +00:00
bors
def4dbb520 Auto merge of #14336 - swarnimarun:remove-slice, r=lnicola
internal: add `as_slice` to `hir::Type`

~`remove_slice`~ `as_slice` is same as `remove_ref` but for slices.

Though there is `as_array` which I believe was named such because it also gets the length of the array, maybe. I am still shaky on the names feel free to suggest corrections.
2023-03-14 09:20:58 +00:00
bors
57803753b0 Auto merge of #14347 - HKalbasi:dev, r=lnicola
Add storage dead for let bindings without initializer

fix #14344
2023-03-14 09:05:36 +00:00
hkalbasi
d7da9e64d1 Add storage dead for let bindings without initializer 2023-03-14 12:15:16 +03:30
bors
4cbb940cc4 Auto merge of #14337 - Veykril:vscode-status, r=lnicola
internal: Allow the status bar item to be clicked again

And give that the most useful action for the given state.
2023-03-14 07:23:17 +00:00