Commit Graph

14653 Commits

Author SHA1 Message Date
Lukas Wirth
7370a6b5b8 fix: Fix flyimport showing functions in pattern position 2022-03-21 19:41:39 +01:00
Laurențiu Nicola
1a37b17162 Replace write! with direct calls 2022-03-21 10:43:36 +02:00
bors[bot]
b594f9c441
Merge #11690
11690: feat: Add an assist for inlining type aliases r=Veykril a=steven-joruk

I'm working towards implementing #10881, but I'd like to get this in first with earlier feedback.

Is `inline_type_alias` a good enough name? I guess the follow up assist would be called `inline_type_alias_into_all_users` based on that.

![valid_inlines](https://user-images.githubusercontent.com/1277939/158020510-fed78b5c-4c7e-46d1-9151-3044a29b9990.gif)

![invalid_inlines](https://user-images.githubusercontent.com/1277939/158020516-8a2deb6d-c6ec-4adf-a15b-c514fc97dc43.gif)



Co-authored-by: Steven Joruk <steven@joruk.com>
2022-03-20 21:15:49 +00:00
Steven Joruk
1381a2de23 refactor: Do more work in inline_type_alias closure 2022-03-20 20:53:03 +00:00
bors[bot]
6f2b118605
Merge #11775
11775: internal: Treat `global_asm` and `asm` macros as unsafe r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:31:27 +00:00
Lukas Wirth
ddf144051a internal: Treat {global_}asm macros as unsafe 2022-03-20 19:31:00 +01:00
bors[bot]
fedf724d82
Merge #11774
11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril

as long as they aren't inside an unsafe block inside the macro that is.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:15:29 +00:00
Lukas Wirth
3b7b223b25 Simplify 2022-03-20 19:13:50 +01:00
Lukas Wirth
68de7b30e0 feat: Tag macro calls as unsafe if they expand to unsafe expressions 2022-03-20 19:07:44 +01:00
bors[bot]
966b692422
Merge #11771
11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril

Disabled by default.

![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/11275


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 13:47:16 +00:00
Lukas Wirth
5a87f09a71 Update inlay hint feature docs 2022-03-20 14:41:27 +01:00
Lukas Wirth
37b48ceb8f feat: Visualize compiler inserted reborrows via inlay hints 2022-03-20 14:38:16 +01:00
bors[bot]
a82caff588
Merge #11765
11765: fix: Fix closure hints using macro ranges r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:26:34 +00:00
Lukas Wirth
2598575a35 fix: Fix closure hints using macro ranges 2022-03-19 20:24:09 +01:00
bors[bot]
7315d97347
Merge #11755
11755: feat: Implement lifetime elision hints r=Veykril a=Veykril

With names on:
![Code_erl26zKvuf](https://user-images.githubusercontent.com/3757771/159134856-e2c75d2d-f17c-45c7-9a78-3da5ee8b1acd.png)
With names off:
![Code_MRP1Pbfe9d](https://user-images.githubusercontent.com/3757771/159134857-30fac3a1-825e-4f49-ba9b-9fa0bb215694.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:15:06 +00:00
Lukas Wirth
7da5b80f25 Change skip trivial behaviour 2022-03-19 20:12:14 +01:00
Lukas Wirth
7ab0aaa82a Add option to skip trivial cases 2022-03-19 19:01:19 +01:00
Lukas Wirth
45756c823f Use numbers for lifetimes by default, add setting to prefer using parameter names 2022-03-19 18:11:56 +01:00
Jonas Schievink
55d2a25123 Rename call info to "signature help"
It is no longer limited to just calls
2022-03-18 20:19:35 +01:00
Jonas Schievink
0642724e94 Provide signature help when editing generic args 2022-03-18 19:59:41 +01:00
Lukas Wirth
c22fed895e Fix test fixtures 2022-03-18 18:57:15 +01:00
Lukas Wirth
b634d99361 Give the lifetimes better names 2022-03-18 18:55:03 +01:00
Lukas Wirth
673e2b1d8f feat: Implement lifetime elision hints 2022-03-18 18:11:16 +01:00
bors[bot]
e3217c5015
Merge #11752
11752: internal: Allow explicitly specifying end of fixture annotation r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-18 16:38:32 +00:00
Lukas Wirth
890f98f21f internal: Allow explicitly specifying end of fixture annotation 2022-03-18 15:42:19 +01:00
Jonas Schievink
14203c6378 Complete assoc const patterns on builtin types 2022-03-18 15:36:18 +01:00
bors[bot]
849ac25f05
Merge #11713
11713: Complete associated consts in patterns  r=jonas-schievink a=hi-rustin

Try close https://github.com/rust-analyzer/rust-analyzer/issues/11555

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2022-03-18 13:54:09 +00:00
Jonas Schievink
e7564086f4
Update crates/ide_completion/src/tests/pattern.rs 2022-03-18 14:53:44 +01:00
bors[bot]
6ad8c022ed
Merge #11750
11750: fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-18 11:13:37 +00:00
Lukas Wirth
828196be3b fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros 2022-03-18 12:01:59 +01:00
Laurențiu Nicola
86b1ef9ab2 Bump deps 2022-03-17 19:24:37 +02:00
Florian Diebold
60aeb8fa1a Move fallback_bound_vars to the only place it's used now 2022-03-17 17:08:43 +01:00
Florian Diebold
9ea2e0bd5b Fixes for consts 2022-03-17 17:04:32 +01:00
Florian Diebold
59b5696aaa Snapshot obligations 2022-03-17 17:04:32 +01:00
Florian Diebold
8f5b6ac556 Properly try unifying the receivers during method resolution
Instead of hackily checking if they're equal.
2022-03-17 17:03:54 +01:00
hi-rustin
bc8665e14d Fix typo
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 22:59:47 +08:00
Florian Diebold
1b71cd074d Add test for DynMap type inference 2022-03-17 15:44:14 +01:00
hi-rustin
2bc545d9ef Match the enum and union
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 21:38:21 +08:00
bors[bot]
631b504991
Merge #11741
11741: Emit #[must_use] in Generate enum is_variant assist r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-17 13:23:22 +00:00
bors[bot]
0a18e4355a
Merge #11740
11740: Insert #[must_use] in generate_is_empty_from_len r=lnicola a=Walther

Inserts `#[must_use]` for the generated `is_empty` methods. I also added the `#[must_use]` for the `len()` methods in the documentation examples and tests for this generator while at it, to make sure they too encourage the use of the annotation.

From discussion in https://github.com/rust-analyzer/rust-analyzer/issues/11736 and https://github.com/rust-analyzer/rust-analyzer/pull/11738

Co-authored-by: Walther <veeti.haapsamo@gmail.com>
2022-03-17 13:14:26 +00:00
Laurențiu Nicola
de53232ada Emit #[must_use] in Generate enum is_variant assist 2022-03-17 15:10:25 +02:00
Walther
217b30568e Insert #[must_use] in generate_is_empty_from_len 2022-03-17 15:03:02 +02:00
bors[bot]
502e30e676
Merge #11737 #11739
11737: Emit `#[must_use]` in `Generate new` assist r=lnicola a=lnicola

Closes #11736

11739: Insert #[must_use] in generate_getter r=lnicola a=Walther

Inserts `#[must_use]` for the generated getter methods.

From discussion in https://github.com/rust-analyzer/rust-analyzer/issues/11736 and https://github.com/rust-analyzer/rust-analyzer/pull/11738

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Walther <veeti.haapsamo@gmail.com>
2022-03-17 12:58:14 +00:00
Walther
e5adbd88e9 Insert #[must_use] in generate_getter 2022-03-17 14:49:22 +02:00
hi-rustin
c6ef4e830e Fix the wrong path resolution
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:39:04 +08:00
hi-rustin
a9aae250ed Add completes_associated_const test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:39:00 +08:00
hi-rustin
37d0c722ef Complete associated consts in patterns
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:35:04 +08:00
Laurențiu Nicola
7e05e10495 Emit #[must_use] in Generate new assist 2022-03-17 14:21:42 +02:00
hkalbasi
0141f28475 fix regression_11688_2 2022-03-17 12:47:31 +03:30
bors[bot]
3bff42fd14
Merge #11734
11734: internal: Bump `xshell` and fix `dist` r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-17 06:54:27 +00:00