Commit Graph

25926 Commits

Author SHA1 Message Date
bors
0fa822dfe1 Auto merge of #15418 - oxalica:fix/sig-from-macro, r=Veykril
Fix signature help of methods from macros

Currently the receiver type is copied from AST instead re-formatting through `HirDisplay`. Macro generated functions seem to have no spaces and their signature help are rendered like `fn foo(&'amutself)` instead of `fn foo(&'a mut self)`.
2023-08-15 06:25:13 +00:00
bors
2fbe69d117 Auto merge of #15438 - Veykril:eager-parser-stuck, r=Veykril
fix: Fix parser being stuck in eager macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/15437
2023-08-12 14:30:38 +00:00
Lukas Wirth
9ac88d8d36 Fix parser being stuck in eager macro inputs 2023-08-12 08:27:27 +02:00
bors
6cf06c1675 Auto merge of #15445 - Veykril:worl-symbols-traits, r=Veykril
fix: Fix `only_types` config filtering out traits from world symbols

It is a bit confusing that this apparently did not filter every trait out though...

Closes https://github.com/rust-lang/rust-analyzer/issues/15444
Closes https://github.com/rust-lang/rust-analyzer/issues/15200
2023-08-12 04:55:17 +00:00
Lukas Wirth
d6d188fce2 fix: Fix only_types config filtering out traits from world symbols 2023-08-12 06:40:49 +02:00
bors
39ebc378c2 Auto merge of #15436 - Veykril:temp-alloc, r=Veykril
Preserve `resolve_obligations_as_possible` temporary allocation across calls

This saves ~20ms in the highlihting bench on my machine
```
  284ms - highlight
      150ms - infer:wait @ per_query_memory_usage
          150ms - infer_query
                0   - PerNs::filter_visibility (436 calls)
                0   - crate_def_map:wait (336 calls)
                2ms - deref_by_trait (909 calls)
                0   - generic_params_query (1 calls)
                0   - inherent_impls_in_block_query (1 calls)
              107ms - resolve_obligations_as_possible (17013 calls)
                0   - trait_solve::wait (1017 calls)
        0   - PerNs::filter_visibility (13 calls)
       17ms - Semantics::analyze_impl (19 calls)
        0   - SourceBinder::to_module_def (30 calls)
        0   - attrs_query (6 calls)
        0   - classify_lifetime (1 calls)
        0   - classify_lifetime_ref (4 calls)
       35ms - classify_name (28 calls)
       54ms - classify_name_ref (452 calls)
        0   - crate_def_map:wait (375 calls)
        7ms - descend_into_macros (776 calls)
        0   - generic_params_query (5 calls)
        0   - impl_data_with_diagnostics_query (1 calls)
       17ms - infer:wait (32 calls)
        0   - resolve_obligations_as_possible (1 calls)
        0   - source_file_to_def (1 calls)
        0   - trait_solve::wait (1 calls)
```
to
```

  256ms - highlight
      121ms - infer:wait @ per_query_memory_usage
          121ms - infer_query
                0   - PerNs::filter_visibility (436 calls)
                0   - crate_def_map:wait (336 calls)
                2ms - deref_by_trait (909 calls)
                0   - generic_params_query (1 calls)
                0   - inherent_impls_in_block_query (1 calls)
               81ms - resolve_obligations_as_possible (17013 calls)
                0   - trait_solve::wait (1017 calls)
        0   - PerNs::filter_visibility (13 calls)
       17ms - Semantics::analyze_impl (19 calls)
        0   - SourceBinder::to_module_def (30 calls)
        0   - attrs_query (6 calls)
        0   - classify_lifetime (1 calls)
        0   - classify_lifetime_ref (4 calls)
       35ms - classify_name (28 calls)
       56ms - classify_name_ref (452 calls)
        0   - crate_def_map:wait (375 calls)
        7ms - descend_into_macros (776 calls)
        0   - generic_params_query (5 calls)
        0   - impl_data_with_diagnostics_query (1 calls)
       16ms - infer:wait (32 calls)
        0   - resolve_obligations_as_possible (1 calls)
        0   - source_file_to_def (1 calls)
        0   - trait_solve::wait (1 calls)
```
2023-08-12 04:38:32 +00:00
Lukas Wirth
c1c8e787d2 Preserve resolve_obligations_as_possible temporary allocation across calls 2023-08-12 06:36:31 +02:00
bors
1fde334195 Auto merge of #15433 - alibektas:deunwrap/remove_unused_imports, r=lnicola
minor : Deunwrap remove_unused_imports

#15398 Subtask 3
2023-08-11 11:14:45 +00:00
bors
de28baf874 Auto merge of #15424 - lnicola:remove-remove-dbg-unwrap, r=lnicola
minor: Remove `unwrap` from `Remove dbg!`

Part of #15398.
2023-08-11 07:56:10 +00:00
bors
1b678231d7 Auto merge of #15435 - Veykril:block-src, r=Veykril
Derive block attributes from block item tree
2023-08-10 18:24:21 +00:00
Lukas Wirth
9adff006e8 Simplify 2023-08-10 20:10:19 +02:00
Lukas Wirth
bfad781a77 Memoize block_item_tree_query 2023-08-10 19:24:39 +02:00
Lukas Wirth
fde2d9b47c Deduplicate FileId field in ModuleOrigin 2023-08-10 19:04:46 +02:00
Lukas Wirth
e5b23e3bc1 Derive block attributes from block item tree 2023-08-10 18:52:27 +02:00
Ali Bektas
423b00a83a Deunwrap remove_unused_imports 2023-08-10 01:22:26 +02:00
bors
05b0612051 Auto merge of #15428 - Veykril:lsp-types-pin, r=Veykril
Fix pinned version of lsp-types

lsp-types published a new patch version that breaks semver with the proposed feature set (this is intended and documented), we unfortunately forgot to specify the patch version for the pinned version so this breaks us.
2023-08-09 18:07:44 +00:00
Lukas Wirth
7e04142f25 Fix pinned version of lsp-types 2023-08-09 20:06:08 +02:00
bors
b78d69c795 Auto merge of #15422 - Veykril:import-sources, r=Veykril
internal: Record import source IDs

cc https://github.com/rust-lang/rust-analyzer/issues/14079
2023-08-09 15:09:15 +00:00
Lukas Wirth
63aba76735 Remove unnecessary ItemTreeId field in ImportSource 2023-08-09 17:06:52 +02:00
Laurențiu Nicola
b658f9a954 Remove unwrap from Remove dbg 2023-08-09 17:54:34 +03:00
bors
b6ee96c3b5 Auto merge of #15423 - alibektas:deunwrap/convert_named_struct_to_tuple_struct, r=lnicola
internal : Deunwrap convert_named_struct_to_tuple_struct

Replaces `unwrap`s with `?` for the mentioned assist.
2023-08-09 14:52:09 +00:00
Ali Bektas
4e4dda5f59 Deunwrap convert_named_struct_to_tuple_struct 2023-08-09 16:40:23 +02:00
Lukas Wirth
c516dd51e9 Simplify 2023-08-09 15:54:10 +02:00
Lukas Wirth
992b928a93 Record import source IDs 2023-08-09 15:20:42 +02:00
bors
4bed01c36e Auto merge of #15421 - Veykril:workspace-loading, r=Veykril
internal: More error context when failing to invoke the rust toolchain
2023-08-09 12:10:21 +00:00
Lukas Wirth
18b24f60d0 More error context when failing to invoke the rust toolchain 2023-08-09 14:09:37 +02:00
bors
fc2f90e0e5 Auto merge of #15419 - HKalbasi:mir, r=HKalbasi
Add mir lower support for tuple destructing assignment

And some other changes in mir eval
2023-08-08 21:02:57 +00:00
hkalbasi
021802c59c Support enum in memory map patch address 2023-08-09 00:27:23 +03:30
bors
ddbbd6a7e7 Auto merge of #15417 - lowr:patch/purge-generic-arg-data-in-expr, r=HKalbasi
internal: use `Cast::cast()` instead of explicit interning

I firmly believe that we should generally use `cast()` instead of interning `GenericArgData` to construct `GenericArg` because it's less verbose and more readable.
2023-08-08 19:27:18 +00:00
bors
e13fac379e Auto merge of #15262 - adamse:master, r=HKalbasi
add check.ignore to list cargo check diagnostics to ignore (dead_code, unused_imports, ...)

fixes #14798
2023-08-08 18:49:45 +00:00
oxalica
de86444756
Prefer hir::SelfParam and fix signature help of methods from macros 2023-08-09 02:42:08 +08:00
oxalica
6a2f83a8a2
Impl HirDisplay for SelfParam 2023-08-09 02:26:44 +08:00
bors
6918eb6ebd Auto merge of #15416 - oxalica:fix/hover-assoc-type, r=lowr
Display fully qualified associated types correctly

Currently they are formatted in the internal `Trait<Self = Type>::Assoc` forms where `hir_ty::TypeRef` is formatted, like hover.

There is no test of `TypeRef::hir_fmt` in crate `hir-ty` (verified by replacing it with a `panic!()`), most tests are about inference and printing the real `Ty` instead of `TypeRef`. So I added the test in `ide::hover`.
2023-08-08 16:42:39 +00:00
oxalica
3bfe1d5d78
Display fully qualified associated types correctly
Currently they are formatted in the internal `Trait<Self = Type>::Assoc`
forms where `hir_ty::TypeRef` is formatted, like hover.
2023-08-09 00:04:55 +08:00
Ryo Yoshida
6aa03c5d15
Use Cast::cast() instead of interning GenericArgData 2023-08-09 00:47:29 +09:00
bors
af4ba46b40 Auto merge of #15405 - lowr:patch/doc-links-to-fields, r=Veykril
Support doc links that resolve to fields

Fixes #15331

Also removes `Resolver::resolve_module_path_in_trait_assoc_items()` and reimplements it in hir with other `Resolver` methods to decouple things a bit.
2023-08-08 14:13:27 +00:00
bors
783130bd26 Auto merge of #15250 - lowr:fix/extract-fn-no-control-flow-with-tail-expr, r=Veykril
fix: don't use control flow when extracted fn contains tail expr of original fn

Fixes #10113
Fixes #15061
2023-08-08 13:38:49 +00:00
bors
ed4e28b2db Auto merge of #15217 - Sarrus1:fix/unsafe-unwrap, r=Veykril
internal: convert unwrap to except and add a debug log

Remove an unsafe unwrap that can cause crashes if the value is a `SendError`.

This is my first PR on this repo, please let me know if there is anything I can improve or details I can provide.
2023-08-08 13:23:21 +00:00
bors
f98d654ddf Auto merge of #15350 - max-heller:issue-11756, r=Veykril
Handle `#[cfg]`s on generic parameters

Records attributes on generic parameters in the item tree and filters out generic parameters disabled by `#[cfg]`s in `generic_params_query`.

Closes #11756
2023-08-08 13:05:26 +00:00
Charles
02d5c0ac56
chore: convert unwrap to except and add a debug log 2023-08-08 14:55:56 +02:00
bors
44eeaea68b Auto merge of #15415 - Veykril:eager-parser-input, r=Veykril
fix: Fix float parser hack creating empty NameRef tokens

Fixes https://github.com/rust-lang/rust-analyzer/issues/15403
2023-08-08 12:46:32 +00:00
Lukas Wirth
cba39f8553 fix: Fix float parser hack creating empty NameRef tokens 2023-08-08 14:44:33 +02:00
Adam Sandberg Ericsson
9cb1f45e6f add check.ignore to list cargo check diagnostics to ignore (dead_code, unused_imports, ...)
fixes #14798
2023-08-08 14:28:35 +02:00
hkalbasi
31c30933cf Support closure in clone shim 2023-08-08 01:49:34 +03:30
bors
d9e9ca2981 Auto merge of #15409 - lnicola:sync-from-rust, r=lnicola
minor: Sync from downstream
2023-08-07 12:16:59 +00:00
Laurențiu Nicola
0c00198d45 Merge branch 'master' into sync-from-rust 2023-08-07 15:15:59 +03:00
Laurențiu Nicola
aa55ce9567 Merge commit 'baee6b338b0ea076cd7a9f18d47f175dd2ba0e5d' into sync-from-ra 2023-08-07 12:03:15 +03:00
hkalbasi
b96e4f2f4a Add mir lower support for tuple destructing assignment 2023-08-07 02:12:35 +03:30
bors
baee6b338b Auto merge of #15406 - lowr:fix/panic-missing-impl-self-ty, r=lnicola
Don't provide `generate_default_from_new` when impl self ty is missing

Also don't provide the assist when the `Default` trait can't be found.

Part of #15398
2023-08-06 18:30:09 +00:00
Ryo Yoshida
582917453b
Don't provide generate_default_from_new when impl self ty is missing
Also don't provide the assist when the `Default` trait can't be found.
2023-08-07 03:23:41 +09:00