Commit Graph

836 Commits

Author SHA1 Message Date
Florian Diebold
6858694001 Add some tests 2022-02-25 11:47:14 +01:00
Lukas Wirth
41b6b372a7 fix: Resolve private fields in type inference 2022-02-23 16:45:58 +01:00
bors[bot]
24255e5b3d
Merge #11481
11481: Display parameter names when hovering over a function pointer r=Veykril a=Vannevelj

Implements #11474

The idea is pretty straightforward: previously we constructed the hover based on just the parameter types, now we pass in the parameter names as well. I went for a quick-hit approach here but I expect someone will be able to point me to a better way of resolving the identifier.

I haven't figured out yet how to actually run my rust-analyzer locally so I can see it in action but the unit test indicates it should work.

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-02-21 13:08:31 +00:00
Jeroen Vannevel
9c6542f209
parameters.split_last() 2022-02-21 10:29:38 +00:00
Chayim Refael Friedman
a1b7169b48 Update tests
Unfortunately, we lost some recovery for expressions.
2022-02-21 08:34:35 +02:00
Chayim Refael Friedman
13ac5c3491 Fix various IDE features
As a side benefit, we got `let` guard support for `move_guard` for free.
2022-02-21 08:34:35 +02:00
Chayim Refael Friedman
fe1e324694 Type-inference for let expressions 2022-02-21 08:34:35 +02:00
Jeroen Vannevel
d1fc208c9c
re-added FIXME 2022-02-18 09:12:52 +00:00
Chayim Refael Friedman
4b2985a23e Infer the array size for slice patterns 2022-02-16 12:19:26 +00:00
Jeroen Vannevel
f083c86890
simplified write 2022-02-15 19:27:56 +00:00
Jeroen Vannevel
e1df78820e
removed unwrap 2022-02-15 14:58:06 +00:00
Jeroen Vannevel
0a80cc82b1
cleaning 2022-02-15 14:55:21 +00:00
Jeroen Vannevel
3bba811e92
fmt 2022-02-15 14:47:51 +00:00
Jeroen Vannevel
c450d0ce41
cleanup 2022-02-15 14:47:23 +00:00
Jeroen Vannevel
73e49493bd
rough, but appears to work 2022-02-15 14:39:22 +00:00
Lukas Wirth
6940cca760 Move attribute path completions into attribute completion module 2022-02-03 15:50:14 +01:00
Florian Diebold
4ed5fe1554 Fix assoc type shorthand from method bounds
In code like this:
```rust
impl<T> Option<T> {
    fn as_deref(&self) -> T::Target where T: Deref {}
}
```

when trying to resolve the associated type `T::Target`, we were only
looking at the bounds on the impl (where the type parameter is defined),
but the method can add additional bounds that can also be used to refer
to associated types. Hence, when resolving such an associated type, it's
not enough to just know the type parameter T, we also need to know
exactly where we are currently.

This fixes #11364 (beta apparently switched some bounds around).
2022-02-03 13:15:02 +01:00
Lukas Wirth
d7a544e69a fix: Complete functions and methods from block level impls 2022-02-01 23:29:40 +01:00
Laurențiu Nicola
bdfdb525bb Bump chalk 2022-01-21 19:51:21 +02:00
Jonas Schievink
601dc50b5a Print a single ellipsis for any number of omitted types 2022-01-10 16:55:53 +01:00
bors[bot]
40009e07d0
Merge #11145
11145: feat: add config to use reasonable default expression instead of todo! when filling missing fields r=Veykril a=bnjjj

Use `Default::default()` in struct fields when we ask to fill it instead of putting `todo!()` for every fields

before:

```rust
pub enum Other {
    One,
    Two,
}

pub struct Test {
    text: String,
    num: usize,
    other: Other,
}

fn t_test() {
    let test = Test {<|>};
}
``` 

after: 

```rust
pub enum Other {
    One,
    Two,
}

pub struct Test {
    text: String,
    num: usize,
    other: Other,
}

fn t_test() {
    let test = Test {
        text: String::new(),
        num: 0,
        other: todo!(),
    };
}
``` 



Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
2022-01-07 14:10:11 +00:00
Benjamin Coenen
f4ce0d78bb add better default behavior on fill struct fields diagnostic
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-06 15:42:29 +01:00
Aaron Hill
04cb85032f
Remove unused lifetime 2022-01-05 10:19:10 -05:00
bors[bot]
ac3ea3e81c
Merge #11112
11112: Evaluate constants in array repeat expression r=HKalbasi a=HKalbasi

cc #8655 

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-01-04 21:51:37 +00:00
hkalbasi
75c2acae6e Evaluate constants in array repeat expression 2022-01-05 01:17:01 +03:30
bors[bot]
b14af5cc6f
Merge #11115
11115: internal: refactor: avoid separate traversal in replace filter map next with find map r=Veykril a=rainy-me

fix: #7428

Co-authored-by: rainy-me <github@yue.coffee>
2022-01-03 16:00:05 +00:00
Kirill Bulatov
03291db801 Allow adding partially resolved types 2022-01-03 01:34:33 +02:00
rainy-me
d77d3234ce refactor: avoid filter map next with find map separate traversal 2021-12-25 09:08:13 +09:00
hkalbasi
e6139cf47b show values of constants in hover 2021-12-23 17:53:46 +03:30
bors[bot]
851af5a52b
Merge #11074
11074: Bump default CHALK_SOLVER_MAX_SIZE to 150 r=lnicola a=lnicola

Fixes #11072

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-20 18:38:47 +00:00
Laurențiu Nicola
3f3aee53b4 Bump default CHALK_SOLVER_MAX_SIZE to 150 2021-12-20 20:35:45 +02: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
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
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
32b6f103a6 Bump chalk 2021-12-19 18:58:39 +02:00
Jonas Schievink
fcc76e93a0 Initial support for #[rustc_legacy_const_generics] 2021-12-17 18:45:56 +01:00
iDawer
676744be6e Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
zhoufan
c3ad945d9b fixes broken tests 2021-12-14 15:57:58 +08:00
zhoufan
7b952cb1aa infer associated method in local scope 2021-12-14 15:34:57 +08:00
bors[bot]
0eb6039e4e
Merge #10987
10987: fix: respect inner attributes for Structs and Enums r=lnicola a=rainy-me

fix: #10980 (the allow/deny issue is not fully resolved though.)

Co-authored-by: rainy-me <github@yue.coffee>
2021-12-11 17:20:14 +00:00
rainy-me
a0c52794bd fix: lookup upwards for struct and enum 2021-12-12 01:23:27 +09:00
Lukas Wirth
1bbc255ec5 Remove some allocations 2021-12-10 20:01:24 +01:00
Lukas Wirth
c81aa68afe Don't show trait flyimports for impl trait and placeholders 2021-12-10 19:18:21 +01:00
Lukas Wirth
c469f8abcb internal: Shrink TraitImpls and InherentImpls HashMaps 2021-12-09 18:39:46 +01:00
Lukas Wirth
e1a236d65e Simplify 2021-12-09 18:28:10 +01:00
Lukas Wirth
f9c59d3752 Use known names instead of string literals 2021-12-09 18:13:15 +01:00