Commit Graph

13899 Commits

Author SHA1 Message Date
bors[bot]
d3aa2579cc
Merge #11069
11069: fix: Partially fix `ide_db::search` for crate roots r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10007
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 16:50:35 +00:00
Lukas Wirth
5206946674 fix: Partially fix ide_db::search for crate roots 2021-12-20 17:48:47 +01:00
bors[bot]
8dc3a270f6
Merge #11067
11067: internal: Store function param names in ItemTree r=Veykril a=Veykril

This prevents us reparsing source files for completions, sometimes slowing them down massively if the source file is not cached at the expense of a slightly bigger memory usage.

related info https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Completion.20performance

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 14:43:39 +00:00
Lukas Wirth
8eb7ee9099 Update test output 2021-12-20 15:43:15 +01:00
Lukas Wirth
cd9d76e0ca internal: Store function param names in ItemTree 2021-12-20 15:24:37 +01:00
bors[bot]
f46731a230
Merge #11028
11028: Bump MSRV (1.57) r=Veykril a=iDawer

This bumps MSRV on all crates to 1.57 except `la-arena`

#10986 requires >=1.57 

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
Lukas Wirth
f609efff87 Simplify 2021-12-20 14:38:22 +01:00
bors[bot]
14ff3d7e5f
Merge #11065
11065: internal: Don't kick off inference in `Semantics::descend_into_macros_impl` r=Veykril a=Veykril

We do not need inference info here so there is no point in calculating it
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 12:49:48 +00:00
Lukas Wirth
a574434c3f Simplify NameClass::classify 2021-12-20 13:47:06 +01:00
Lukas Wirth
37a87708ae internal: Don't kick off inference in Semantics::descend_into_macros_impl 2021-12-20 13:19:48 +01:00
bors[bot]
48d6cef436
Merge #10484
10484: internal: Update match checking algorithm r=lnicola a=iDawer

Sync match checking algorithm with rust-lang/rust f31622a50 2021-11-12 (https://github.com/rust-lang/rust/pull/90813)

This update brings huge simplification to the match checking and introduces an easy to use machinery for pattern destructuring and also:

1. Add a function to do post-inference normalization `hir_ty::infer::normalize(...)`.
2. Store binding modes in `InferenceResult`.

Todo:

- [x] Rebase & test (https://github.com/rust-analyzer/rust-analyzer/pull/10484#issuecomment-996669665)

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 12:05:23 +00:00
bors[bot]
2ca3834c9f
Merge #11062
11062: fix: Don't say "a reference to" for `Copy` types in the generate getter assist r=Veykril a=patrick-gu

This changes the generate getter assist to not say "a reference to" in the documentation stub if the type is `Copy`, as the getter does not return a reference.

To determine whether the type is `Copy`, I have added an `is_copy` method to `ReferenceConversion`.

Co-authored-by: patrick-gu <55641350+patrick-gu@users.noreply.github.com>
2021-12-20 09:14:38 +00:00
patrick-gu
76b50f14f7 Don't say "a reference to" for Copy types
This changes the generate getter assist to not say "a reference to" in the documentation stub if the type is Copy, as the getter does not return a reference.
2021-12-19 17:28:31 -08:00
iDawer
a9ad7be748 Respect binding mode of a binding pattern for exhaustiveness check 2021-12-20 00:14:39 +05:00
iDawer
b17aefb83a internal: Normalize field type after substituting 2021-12-20 00:14:39 +05:00
iDawer
1280961b51 internal: sync match checking with rust-lang/rust f31622a50 2021-11-12 2021-12-20 00:10:01 +05:00
Dawer
deb05930ef internal: Sync match checking algorithm with rustc
Original version: rust-lang/rust  68b76a483 2021-10-01
2021-12-20 00:10:01 +05:00
Laurențiu Nicola
c9ca77f641 Bump object 2021-12-19 19:00:42 +02:00
Laurențiu Nicola
32b6f103a6 Bump chalk 2021-12-19 18:58:39 +02:00
ucrhh
b289f13c75 fix unwrap_block by removing double trimming 2021-12-18 23:19:53 +01:00
bors[bot]
81d0096000
Merge #11035
11035: Include clippy lint groups in autocomplete r=Veykril a=k-nasa

## Why

close: https://github.com/rust-analyzer/rust-analyzer/issues/11027

## Proof

I confirmed that complement candidates are coming out.

https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov


Co-authored-by: k-nasa <htilcs1115@gmail.com>
2021-12-18 17:59:29 +00:00
rainy-me
67cc6c1e16 feat: treat fn keyword inside function pointer type as primitive 2021-12-19 01:51:51 +09:00
Aleksey Kladov
92dad471bc
Update crates/parser/src/lexed_str.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-12-18 17:34:55 +03:00
Aleksey Kladov
a022ad68c9 internal: move all the lexing to the parser crate 2021-12-18 17:20:38 +03:00
k-nasa
71ac246bd4 refactor: chain iter 2021-12-18 23:19:29 +09:00
Aleksey Kladov
78926027e3 converting lexed str to tokens 2021-12-18 15:36:21 +03:00
Aleksey Kladov
8b9d145dea soa all the things 2021-12-18 15:31:50 +03:00
Aleksey Kladov
799941e05e move tests 2021-12-18 14:55:20 +03:00
Aleksey Kladov
7e99864dbf move lexing to the parser crate 2021-12-18 14:55:20 +03:00
Aleksey Kladov
958f20ff84 minor: dead code 2021-12-18 14:55:20 +03:00
bors[bot]
7f28b49759
Merge #11043
11043: fix: fix incorrect mismatched argument count diagnostic with `std::arch` functions r=jonas-schievink a=jonas-schievink

Adds basic support for `#[rustc_legacy_const_generics]`.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10009

Full support would involve actually checking call arguments against the right expected types.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-12-17 17:46:42 +00:00
Jonas Schievink
fcc76e93a0 Initial support for #[rustc_legacy_const_generics] 2021-12-17 18:45:56 +01:00
bors[bot]
6674756c07
Merge #11041
11041: minor: Fix some clippy lints r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-17 15:52:53 +00:00
Laurențiu Nicola
6c799dac1e Fix some clippy lints 2021-12-17 17:46:20 +02:00
bors[bot]
04b0b19cdb
Merge #10527
10527: internal: Remove a few snippet completions, replace them with user snippets definitions in VSCode r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9636
cc https://github.com/rust-analyzer/rust-analyzer/issues/7033#issuecomment-939959905

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-17 15:44:48 +00:00
Lukas Wirth
2a88b76041 Update tests 2021-12-17 16:39:21 +01:00
Laurențiu Nicola
8ad7c0439c Remove needless clones 2021-12-17 17:35:10 +02:00
Laurențiu Nicola
fb9529626d Spelling nits 2021-12-17 17:26:35 +02:00
Lukas Wirth
9fe0f0d1d9 Add a few default snippets for VSCode 2021-12-17 16:24:29 +01:00
Lukas Wirth
d3e538638a fix: Don't duplicate attribute completions 2021-12-17 15:22:53 +01:00
k-nasa
0e9095e42c manual run sourcegen_lint_completions 2021-12-17 08:46:17 +09:00
k-nasa
7643e08962 Add clippy lint group to attribute auto compleme 2021-12-17 08:34:08 +09:00
k-nasa
4e6e65dd71 List struct to clonable 2021-12-17 08:33:46 +09:00
Wang Ruochen
ee079561b1
Add comma for "move if to guard" 2021-12-15 15:26:24 -08:00
bors[bot]
4ec6bd6206
Merge #11017
11017: Support "move if to guard" with an else branch r=Veykril a=weirane

Support the assist `move_arm_cond_to_match_guard` when there is an else branch.

I have two questions:
1. How to indent the first line of a match arm? `matcharm.indent()` doesn't seem to work. so I hard coded four spaces here:
95a0de85d5/crates/ide_assists/src/handlers/move_guard.rs (L162-L163)

2. I find a little issue in the original implementation, this code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the `false`. Should I also fix that? Or this can go in a separate PR.

Closes #10997.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2021-12-15 23:04:51 +00:00
Wang Ruochen
e8d0742997
Add coverage marks 2021-12-15 14:44:47 -08:00
iDawer
676744be6e Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
Wang Ruochen
95a0de85d5
Support "move if to guard" with an else branch 2021-12-14 10:27:44 -08:00
bors[bot]
9efa355a62
Merge #11011
11011: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-14 11:56:30 +00:00
Lukas Wirth
901c7c7277 match_ast! takes a pattern to allow underscore usage 2021-12-14 12:44:31 +01:00