Commit Graph

19209 Commits

Author SHA1 Message Date
DropDemBits
05b8ccc378
Fix clippy lints 2024-02-08 19:39:04 -05:00
DropDemBits
1161082051
Remove unused code in utils
All usages of `render_snippet` and `Cursor` have been removed as part of the migration
2024-02-08 19:13:10 -05:00
DropDemBits
8eebf1701b
Migrate replace_derive_with_manual_impl to mutable ast 2024-02-08 19:13:10 -05:00
DropDemBits
18ea09feca
Migrate generate_new to mutable ast 2024-02-08 19:13:10 -05:00
DropDemBits
e28f5514e1
Add AssocItemList::add_item_at_start
Needed to recreate the behavior of `generate_new` addding the `new` method at the start of the impl
2024-02-08 19:13:10 -05:00
DropDemBits
e0117154cf
Migrate generate_impl to mutable ast 2024-02-08 19:13:10 -05:00
DropDemBits
ab2233e562
Migrate generate_getter_or_setter to mutable ast 2024-02-08 19:13:09 -05:00
DropDemBits
f1293a8fc4
Add newline to body when where clause is present 2024-02-08 19:13:09 -05:00
DropDemBits
0519414c19
Make ReferenceConversion methods return ast types 2024-02-08 19:13:09 -05:00
DropDemBits
039b3d0abb
Add make::ext::expr_self
Shortcut version of `make::expr_path(make::path_unqualified(make::path_segment_self()))`
2024-02-08 19:09:33 -05:00
DropDemBits
0e39257e5b
Migrate extract_function to mutable ast 2024-02-08 19:09:33 -05:00
DropDemBits
3924a0ef7c
Add ast versions of generate{_trait}_impl_text{_intransitive} 2024-02-08 19:09:33 -05:00
DropDemBits
8c0661b2de
Use GenericArgList for make::impl{_trait}
`make::impl_` no longer merges generic params and args in order to be in line
with `make::impl_`, which doesn't do it either.
2024-02-08 19:09:32 -05:00
bors
13707845f7 Auto merge of #15863 - davidbarsky:davidbarsky/start-of-monorepo-mode, r=Veykril
feature: Create `UnindexedProject` notification to be sent to the client

(Note that this branch contains commits from https://github.com/rust-lang/rust-analyzer/pull/15830, which I'll rebase atop of as needed.)

Based on the discussion in https://github.com/rust-lang/rust-analyzer/issues/15837, I've added a notification and off-by-default toggle to send that notification from `handle_did_open_text_document`. I'm happy to rename/tweak this as needed.

I've been using this for a little bit, and it does seem to cause a little bit more indexing/work in rust-analyzer, but it's something that I'll profile as needed, I think.
2024-02-08 19:36:09 +00:00
David Barsky
6330b028b3 feature: Add a UnindexedProject notification and a corresponding setting. 2024-02-08 14:23:00 -05:00
davidsemakula
602acfcb70 fix conflicting "unnecessary else" and "trailing return" diagnostics tests 2024-02-08 19:32:53 +03:00
davidsemakula
a250c2dde0 refactor remove trailing return diagnostic 2024-02-08 19:32:53 +03:00
davidsemakula
98e6f43a2f remove trailing return in trailing match expression 2024-02-08 19:32:53 +03:00
davidsemakula
cad222ff1b remove trailing return in trailing if expression 2024-02-08 19:32:53 +03:00
davidsemakula
2987fac76f diagnostic to remove trailing return 2024-02-08 19:32:53 +03:00
bors
e07183461f Auto merge of #16487 - ShoyuVanilla:deref-generate-getter, r=Veykril
Remove unnecessary `.as_ref()` in generate getter assist

Resolves #12389
2024-02-08 15:15:52 +00:00
bors
5812b693c3 Auto merge of #16484 - Austaras:master, r=Veykril
fix: preserve where clause when builtin derive

Closes #16432.
2024-02-08 15:03:55 +00:00
austaras
dad0fdb13f fix: preserve where clause when builtin derive 2024-02-08 22:44:39 +08:00
bors
0e5766b0d8 Auto merge of #16477 - davidsemakula:trait-incorrect-case-diagnostic, r=Veykril
feat: Add incorrect case diagnostics for traits and their associated items

Updates incorrect case diagnostic to:
- Check traits and their associated items
- Ignore trait implementations except for patterns in associated function bodies

Also cleans up `hir-ty::diagnostics::decl_check` a bit (mostly to make it a bit more DRY and easier to maintain)

Also fixes: #8675 and fixes: #8225
2024-02-08 14:40:16 +00:00
bors
e9d3565cd1 Auto merge of #16502 - davidsemakula:unnecessary-else-diagnostic, r=Veykril
feat: Add "unnecessary else" diagnostic and fix

Fixes #9457
2024-02-08 14:25:00 +00:00
bors
82674e21be Auto merge of #16454 - Veykril:break-return-postfix, r=Veykril
feat: Add break and return postfix keyword completions
2024-02-08 14:09:04 +00:00
Lukas Wirth
ddddc9c0e2 Update test outputs 2024-02-08 14:57:21 +01:00
Lukas Wirth
15bffe25bd feat: Add break and return postfix keyword completions 2024-02-08 14:56:10 +01:00
Lukas Wirth
545382db25 Fix warnings 2024-02-08 14:54:52 +01:00
Lukas Wirth
91dab4d720 Better error message for when proc-macros have not yet been built 2024-02-08 14:53:12 +01:00
Lukas Wirth
4bf6b160a9 Fix incorrect range uses in missing_fields quick fixes 2024-02-08 14:53:11 +01:00
bors
5c80ad05ae Auto merge of #16124 - ohno418:call-expr-missing-arg, r=Veykril
fix: Recover from missing argument in call expressions

Previously, when parsing an argument list with a missing argument (e.g., `(a, , b)` in `foo(a, , b)`), the parser would stop upon an unexpected token (at the second comma in the example), resulting in an incorrect parse tree.

This commit improves error handling in such cases, ensuring a more accurate parse tree is built.

---

Fixes https://github.com/rust-lang/rust-analyzer/issues/15683.
2024-02-08 10:16:36 +00:00
Lukas Wirth
974e69b0c5 Recover from missing slots in delimited parsing 2024-02-08 11:14:37 +01:00
Yutaro Ohno
e865d45904 fix: Recover from missing argument in call expressions
Previously, when parsing an argument list with a missing argument (e.g.,
`(a, , b)` in `foo(a, , b)`), the parser would stop upon an unexpected
token (at the second comma in the example), resulting in an incorrect
parse tree.

This commit improves error handling in such cases, ensuring a more
accurate parse tree is built.
2024-02-08 10:54:04 +01:00
Lukas Wirth
0258f60cfe feat: Allow cargo check to run on only the current package 2024-02-08 10:40:42 +01:00
Lukas Wirth
81ea48a573 fix: Fix tuple structs not rendering visibility in their fields 2024-02-08 10:05:28 +01:00
clubby789
79e4111442 Remove ffi_returns_twice references 2024-02-07 19:42:07 +00:00
Lukas Wirth
97cd68097a Optimize input queries that take no arguments 2024-02-07 18:04:02 +01:00
Lukas Wirth
3688064ff5 Clippy 2024-02-07 17:08:38 +01:00
Lukas Wirth
731b159f10 Remove dev-dependency diff 2024-02-07 16:34:21 +01:00
Lukas Wirth
e339c65a1a Remove dev-dependency insta 2024-02-07 16:30:20 +01:00
Lukas Wirth
def5a1d0c4 unreachable-pub 2024-02-07 16:30:13 +01:00
Lukas Wirth
bc5823d5bb Bump salsa dev-deps 2024-02-07 16:30:07 +01:00
Lukas Wirth
0a6197df97 rustfmt 2024-02-07 16:30:00 +01:00
Lukas Wirth
159a03ad7b Move salsa fork in-tree 2024-02-07 16:29:46 +01:00
Soham Chowdhury
57a454233c inline_call: ensure correct whitespace in parameter types 2024-02-06 20:24:16 +01:00
davidsemakula
d7a03022f7 handle divergence in child if expr for unnecessary else diagnostic fix 2024-02-06 19:00:10 +03:00
davidsemakula
62cc4f9c46 add unnecessary else diagnostic 2024-02-06 19:00:10 +03:00
Laurențiu Nicola
2c4152847a Add lete to postfix completion list 2024-02-06 13:13:51 +02:00
bors
6671d3c9a3 Auto merge of #16499 - Nadrieril:update-pat-ana, r=lnicola
internal: Update rustc_pattern_analysis dependency

Just bumping the dependency, as I've been making API changes over on the rustc side. More API changes incoming in the coming weeks.

One benefit of this: we no longer abort in the `DeconstructedPat: Debug` impl, which means we can use `tracing` to investigate issues.
2024-02-06 07:04:33 +00:00
Nadrieril
d2d4119d24 Don't need an arena for types anymore 2024-02-06 05:09:30 +01:00
Nadrieril
ba7b12e062 Update rustc_pattern_analysis dependency 2024-02-06 05:08:19 +01:00
Nadrieril
c2d21242aa Tweak variant_id_for_adt 2024-02-06 05:01:05 +01:00
Matthias Krüger
ac9d1a03a7 remove clones 2024-02-05 23:15:47 +01:00
bors
66cec4d11a Auto merge of #16470 - Veykril:clippy-disallow, r=lnicola
internal: Lint debug prints and disallowed types with clippy
2024-02-05 17:20:43 +00:00
dfireBird
53db37f9bf
restrict cursor range to show assists 2024-02-05 18:53:40 +05:30
bors
cb37fcc616 Auto merge of #16493 - Young-Flash:method_call_parser, r=Veykril
fix: emit parser error for missing argument list

close https://github.com/rust-lang/rust-analyzer/issues/16362
2024-02-05 13:03:03 +00:00
Young-Flash
864c3d5880 test: add method_call_missing_argument_list error test 2024-02-05 17:54:09 +08:00
Young-Flash
c495e3f00f fix: emit parser error for missing argument list 2024-02-05 17:54:09 +08:00
bors
7fb639ffc1 Auto merge of #16482 - GnomedDev:boxed-subtree, r=lnicola
Swap Subtree::token_trees from Vec to boxed slice

Performs one of the optimizations suggested in #16325, but a little bit more. Boxed slices guarantee `shrink_to_fit` aswell as saving a pointer width as no capacity has to be stored.

Most of the diff is:
- Changing `vec![]` to `Box::new([])`
- Changing initialize -> fill into fill -> into_boxed_slice
- Working around the lack of an owned iterator or automatic iteration over a `Box<[T]>`

I would like to use my own crate, [small-fixed-array](https://lib.rs/small-fixed-array), although I understand if it isn't mature enough for this. If I'm given the go ahead, I can rework this PR to use it instead.
2024-02-05 09:14:06 +00:00
bors
3e47532dd4 Auto merge of #16474 - davidbarsky:david/import-on-the-fly-improvements, r=lnicola
internal: even more `tracing`

As part of profiling completions, I added some additional spans and moved `TyBuilder::subst_for_def` closer to its usage site (the latter had a small impact on completion performance. Thanks for the tip, Lukas!)
2024-02-05 09:01:58 +00:00
bors
081cf026b8 Auto merge of #16480 - GnomedDev:remove-unused-visit_ids, r=lnicola
Remove unused Subtree::visit_ids function

Completely unused, nothing else even shows up when searching for `visit_ids`.
2024-02-05 08:49:39 +00:00
Shoyu Vanilla
26715a8fde
cargo fmt 2024-02-05 10:48:34 +09:00
Shoyu Vanilla
983cce8c31
Typo fix 2024-02-05 10:37:58 +09:00
Shoyu Vanilla
f0428e57ea
Simplify redundant coercion 2024-02-05 10:35:12 +09:00
davidsemakula
b45ee82811 incorrect case diagnostics for param names of trait impl assoc functions 2024-02-05 01:31:28 +03:00
GnomedDev
a607e1b04b
Use reserve_exact for pushing to Subtree 2024-02-04 22:17:20 +00:00
davidsemakula
33b3b6dbf9 refactor: disable "unused" lint using parameter name 2024-02-05 01:07:44 +03:00
Shoyu Vanilla
97ecfe4fab Remove unnecessary .as_ref() in generate getter assist 2024-02-05 00:44:57 +09:00
Laurențiu Nicola
38b5c8c966 Try to fix in-tree build 2024-02-04 11:07:35 +02:00
Laurențiu Nicola
b8a3180a60 Merge commit '0113bc9388b480fa42c632f57f4f0f7af5813ec1' into sync-from-ra 2024-02-04 10:37:58 +02:00
GnomedDev
8011b56827
Swap Subtree::token_trees from Vec to boxed slice 2024-02-04 00:28:22 +00:00
GnomedDev
1451270372
Remove unused Subtree::visit_ids function 2024-02-03 17:22:45 +00:00
davidsemakula
d761d86f03 refactor hir-ty::diagnostics::decl_check for enum variants 2024-02-03 17:36:11 +03:00
davidsemakula
8e29104178 refactor hir-ty::diagnostics::decl_check for struct fields 2024-02-03 17:33:25 +03:00
davidsemakula
23aa872f3c refactor hir-ty::diagnostics::decl_check for function bodies 2024-02-03 16:40:55 +03:00
davidsemakula
c0071ace5a refactor hir-ty::diagnostics::decl_check 2024-02-03 15:51:14 +03:00
davidsemakula
46d79e21b5 add allow and deny attribute tests for incorrect case diagnostics for traits 2024-02-02 17:07:08 +03:00
davidsemakula
080d223dd4 incorrect case diagnostics for type aliases 2024-02-02 17:07:08 +03:00
davidsemakula
0ffc088439 no incorrect case diagnostics for trait impl assoc functions and consts except for pats in fn bodies 2024-02-02 17:07:08 +03:00
davidsemakula
6d2d6323ac incorrect case diagnostics for trait assoc functions and consts 2024-02-02 17:07:08 +03:00
davidsemakula
5fe3b75677 incorrect case diagnostics for trait name 2024-02-02 17:07:08 +03:00
bors
8f6a72871e Auto merge of #16469 - Young-Flash:ci_typos, r=lnicola
internal: add typos check CI (part 2)

follow up https://github.com/rust-lang/rust-analyzer/pull/16448
2024-02-02 12:02:48 +00:00
Young-Flash
ba2910a3a7 minor: correct some typos 2024-02-02 18:22:54 +08:00
Laurențiu Nicola
4f09335063 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2024-02-02 08:40:28 +02:00
David Barsky
f9bef39d48 internal: add some more tracing spans inside of hir-ty 2024-02-01 16:10:32 -05:00
David Barsky
0fd770613b internal: Move TyBuilder::subst_for_def into a block 2024-02-01 16:06:05 -05:00
Lukas Wirth
9e8a0fae0c Lint debug prints and disallowed types with clippy 2024-02-01 17:57:27 +01:00
bors
850ba2fb63 Auto merge of #16451 - Urhengulas:satisfy-clippy, r=Veykril
internal: Work through temporarily allowed clippy lints, part 2

Another follow-up to https://github.com/rust-lang/rust-analyzer/pull/16401.
2024-02-01 14:23:18 +00:00
bors
42cb1a2bd7 Auto merge of #16465 - Veykril:eprintln, r=Veykril
minor: Remove `stdx::eprintln` overwrite
2024-01-31 21:07:50 +00:00
Lukas Wirth
23f4b7f45f Remove stdx::eprintln overwrite 2024-01-31 22:06:05 +01:00
clubby789
a1fdb876c3 Remove abi_amdgpu_kernel references 2024-01-31 19:06:10 +00:00
bors
039681112f Auto merge of #16456 - davidbarsky:david/tracing-followups, r=Veykril
internal: `tracing` improvements and followups

Hi folks! Building on https://github.com/rust-lang/rust-analyzer/pull/16394, I've got a few small tweaks:
- Removed the accidental `mod.rs` usage that I introduced.
- Removed a panic in `pat_analysis.rs`.
- Recorded the event kind in `handle_event` to better distinguish what _kind_ of event is being handled.
- Did a small refactor of `hprof` to have somewhat more linear control flow, and more importantly, write the recorded fields to the output.

The end result is the following:
<img width="1530" alt="A screenshot of Visual Studio Code on a Mac. `hprof.rs` is open, with " src="https://github.com/rust-lang/rust-analyzer/assets/2067774/bd11dde5-b2da-4774-bc38-bcb4772d1192">
2024-01-31 18:29:51 +00:00
David Barsky
44494e235a internal: teach hprof to record tracing fields 2024-01-31 13:15:47 -05:00
Johann Hemmann
df2c7a6e4e cargo clippy --fix 2024-01-31 19:06:36 +01:00
Johann Hemmann
771c6c9271 format_collect 2024-01-31 19:06:36 +01:00
Johann Hemmann
d37f4e0d21 new_without_default 2024-01-31 19:06:36 +01:00
Johann Hemmann
e7e09e7750 large_enum_variant 2024-01-31 19:06:35 +01:00
Johann Hemmann
04ccef80cb field_reassign_with_default 2024-01-31 19:06:18 +01:00
Johann Hemmann
dd9f27b8d3 borrow_deref_ref 2024-01-31 19:06:18 +01:00