Commit graph

31519 commits

Author SHA1 Message Date
bors
40a1a4e337 Auto merge of #17994 - Veykril:proc-macro-srv-from-str-panic, r=Veykril
fix: Fix TokenStream::to_string implementation dropping quotation marks

Fixes https://github.com/rust-lang/rust-analyzer/issues/17986
We might wanna consider backporting this to beta if that's simple enough to do
2024-08-29 06:46:16 +00:00
Lukas Wirth
abed6e24a8 fix: Fix TokenStream::to_string implementation dropping quotation marks 2024-08-29 08:45:35 +02:00
Lukas Wirth
d6666b16c4 fix: Fix proc-macro server crashing when parsing a non-lexable string into a TokenStream 2024-08-29 08:45:19 +02:00
bors
6f3356d0dd Auto merge of #17992 - Wilfred:newlines_in_logs, r=Veykril
internal: Avoid newlines in fetch errors

Most logs lines don't have newlines, ensure fetch errors follow this pattern. This makes it easier to see which log line is associated with the error.

Before:

    2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError:
    rust-analyzer failed to discover workspace

After:

    2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace
2024-08-29 04:52:11 +00:00
David Richey
2b3183500a Fix incorrect symbol definitions in SCIP output 2024-08-28 19:57:26 -05:00
Wilfred Hughes
730e7fb9b3 internal: Add doc comments to OpQueue 2024-08-28 16:29:18 -07:00
Chayim Refael Friedman
1fc6cbc6f1 Consider field attributes when converting from tuple to named struct and the opposite 2024-08-29 01:14:25 +03:00
Chayim Refael Friedman
f297860715 Also handle deref expressions in "Extract variable"
And BTW, remove the parentheses of the extracted expression if there are.
2024-08-29 00:35:45 +03:00
Wilfred Hughes
efdfb7998f internal: Avoid newlines in fetch workspace errors
Most logs lines don't have newlines, ensure fetch workspace errors follow this
 pattern.

Before:

2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError:
rust-analyzer failed to discover workspace

After:

2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace
2024-08-28 14:18:45 -07:00
Chayim Refael Friedman
1663891d3d Don't add reference when it isn't needed for the "Extract variable" assist
I.e. don't generate `let var_name = &foo()`.

Anything that creates a new value don't need a reference. That excludes mostly field accesses and indexing.

I had a thought that we can also not generate a reference for fields and indexing as long as the type is `Copy`, but sometimes people impl `Copy` even when they don't want to copy the values (e.g. a large type), so I didn't do that.
2024-08-29 00:10:26 +03:00
Chayim Refael Friedman
70c53a6903 Consider all expressions that autoderef in "Extract variable", not just method and field accesses. 2024-08-28 23:55:31 +03:00
Chayim Refael Friedman
1cd707e693 Fix name resolution of shadowed builtin macro 2024-08-28 23:20:46 +03:00
Ali Bektas
5e6f5b1f38 Minor errors 2024-08-28 19:40:58 +02:00
Ali Bektas
987a9342ad Remove invalid tests 2024-08-28 19:33:21 +02:00
Ali Bektas
23eb20794e Make almost every client config global 2024-08-28 19:33:21 +02:00
Ali Bektas
a7207f4b64 Make completion_* local 2024-08-28 19:33:21 +02:00
Ali Bektas
eef79b4e47 Make diagnostics_* local 2024-08-28 19:33:21 +02:00
Ali Bektas
3a4efb4141 Make workspace_symbol_search_* workspace 2024-08-28 19:33:21 +02:00
Ali Bektas
e4edbf4601 Make procMacro_* workspace 2024-08-28 19:33:21 +02:00
Ali Bektas
c304ceeb4c Make rustc_* workspace 2024-08-28 19:33:21 +02:00
Ali Bektas
65d39f32d6 Make runnables workspace 2024-08-28 19:33:21 +02:00
Ali Bektas
c3acdc2fa1 Make check workspace 2024-08-28 19:33:20 +02:00
Ali Bektas
f09997993b Make checkOnSave workspace 2024-08-28 19:30:58 +02:00
Ali Bektas
100d3f9c06 Make cargo_ workspace again 2024-08-28 19:30:55 +02:00
bors
f454ea8771 Auto merge of #17981 - lnicola:proc-macro-cwd, r=Veykril
minor: Fix cwd used for proc macro expansion

Fixes #17980.
2024-08-28 10:36:11 +00:00
Laurențiu Nicola
5f7bda743f Fix cwd used for proc macro expansion 2024-08-28 13:20:21 +03:00
Chayim Refael Friedman
0e4f4d3f9c Create an assist to convert closure to freestanding fn
The assist converts all captures to parameters.
2024-08-27 17:07:55 +03:00
bors
8db40df2a3 Auto merge of #17757 - alibektas:toggle_macro_delimiters, r=Veykril
assist: Add new assist toggle_macro_delimiter

Closes #17716
2024-08-27 12:25:43 +00:00
Ivar Scholten
7d9e4fcc07 fix: do not assume rustup is installed in xtask codegen
When formatting generated code the xtask crate attempts to run `rustup run stable rustfmt`,
which fails if `rustup` is not installed. This results in test failures when another source manages
the compiler toolchain, for example when using Nix (or any other distro-specific packaging solution):

* xtask::codegen::grammar::test
* xtask::codegen::assists_doc_tests::test

With this commit xtask will first attempt to run `rustup run stable rustfmt`, and if that fails just
plain `rustfmt`. It still validates a stable version is being used.

This allows `cargo test` to pass on systems that do not use `rustup`.
2024-08-27 14:25:13 +02:00
Lukas Wirth
a7c519c98f Fix tests 2024-08-27 14:23:23 +02:00
bors
b675c93fc5 Auto merge of #17974 - lnicola:rm-apache-appendix, r=lnicola
internal: Drop Apache license appendices

Closes #14586

Similar to https://github.com/rust-lang/rust/pull/67734
2024-08-27 12:08:25 +00:00
bors
06a40a61b0 Auto merge of #17973 - Veykril:proc-macro-curr-dir, r=Veykril
Expand proc-macros in workspace root, not package root

Should fix https://github.com/rust-lang/rust-analyzer/issues/17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)
2024-08-27 11:53:04 +00:00
Laurențiu Nicola
90f903b521 Drop Apache license appendices 2024-08-27 14:52:34 +03:00
Lukas Wirth
9a47e6f2c8 Expand proc-macros in workspace root, not package root 2024-08-27 13:40:24 +02:00
bors
66b9b56853 Auto merge of #17970 - ChayimFriedman2:unwrap-unsafe-block, r=Veykril
fix: Fix "Unwrap block" assist with block modifiers

The assist just assumes the `{` will be the first character, which led to strange outputs such as `nsafe {`.

Fixes #17964.
2024-08-27 09:17:10 +00:00
bors
0f7f68dad2 Auto merge of #17972 - rust-lang:revert-17936-module_path, r=Veykril
Revert "feat: Implement `module_path` macro"

Reverts rust-lang/rust-analyzer#17936 Fixes https://github.com/rust-lang/rust-analyzer/issues/17968
2024-08-27 06:21:03 +00:00
Lukas Wirth
fa48bc216c
Revert "feat: Implement module_path macro" 2024-08-27 08:19:09 +02:00
Chayim Refael Friedman
104c29764b Fix "Unwrap block" assist with block modifiers
The assist just assumes the `{` will be the first character, which led to strange outputs such as `nsafe {`.
2024-08-26 19:02:36 +03:00
bors
095926ea6f Auto merge of #17963 - avrong:avrong/error-lifetimes, r=Veykril
Always show error lifetime arguments as `'_`

Fixes #17947

Changed error lifetime argument presentation in non-test environment to `'_` and now showing them even if all of args are error lifetimes.

This also influenced some of the other tests like `extract_function.rs`, `predicate.rs` and `type_pos.rs`. Not sure whether I need to refrain from adding lifetimes args there. Happy to fix if needed
2024-08-26 10:06:21 +00:00
Aleksei Trifonov
f1b4a9cfb0 Show lifetime args if there are only error ones 2024-08-26 12:19:50 +03:00
Aleksei Trifonov
7ea4241afa Show and render error lifetime args as '_ 2024-08-26 12:19:42 +03:00
bors
0ad26e6025 Auto merge of #17941 - ChayimFriedman2:pre-closure-to-fn, r=Veykril
Preliminary work for #17940

I split the PR as requested, and made small commits.
2024-08-26 08:09:15 +00:00
bors
cd734cb7ae Auto merge of #17962 - ChayimFriedman2:update-rtn, r=Veykril
fix: Fix Return Type Syntax to include `..` (i.e. `method(..)` and not `method()`) as specified in the RFC

Fixes #17952.
2024-08-26 07:51:30 +00:00
Chayim Refael Friedman
21e6058ab7 Fix Return Type Syntax to include .. (i.e. method(..) and not method()) as specified in the RFC 2024-08-26 01:45:52 +03:00
bors
7106cd3be5 Auto merge of #17960 - duncanawoods:master, r=HKalbasi
fix: add extra_test_bin_args to test explorer test runner

`@HKalbasi` I thought I included this in #17470 but it appears not so I have created a new issue #17959 for this fix.
2024-08-25 11:48:32 +00:00
bors
316590f5b1 Auto merge of #17961 - Veykril:autoderef-alloc, r=Veykril
internal: Don't allocate autoderef steps when not needed
2024-08-25 11:13:53 +00:00
Lukas Wirth
b6ed2f5a41 internal: Don't allocate autoderef steps when not needed 2024-08-25 13:12:07 +02:00
duncan
18081eabd0 fix: add extra_test_bin_args to test explorer test runner
trim whitespace
2024-08-25 12:11:36 +01:00
bors
071997d475 Auto merge of #17958 - Veykril:deref-chain-method-completions, r=Veykril
fix: Fix trait method completions not acknowledging Deref impls
2024-08-25 08:56:23 +00:00
Lukas Wirth
737d5088e5 fix: Fix trait method completions not acknowledging Deref impls 2024-08-25 10:47:30 +02:00