Commit Graph

13536 Commits

Author SHA1 Message Date
Kirill Bulatov
3f612d37c6 Move the helpers into ide_db 2020-11-28 16:30:39 +02:00
Kirill Bulatov
7b145bd99c Rustdocs fixes 2020-11-27 19:05:10 +02:00
Kirill Bulatov
f75f07019b Group import data in a struct 2020-11-27 18:30:10 +02:00
Kirill Bulatov
f4ae3650d8 Extract the import code into the shared module 2020-11-27 18:28:41 +02:00
bors[bot]
0993f9067c
Merge #6651
6651: Profile completions better r=SomeoneToIgnore a=SomeoneToIgnore

During https://github.com/rust-analyzer/rust-analyzer/issues/6612 investigation, had added a few more profiling points and considered that they can be useful later, ergo the PR.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-11-27 16:14:04 +00:00
Kirill Bulatov
04cd4b17bb
Fix the profiling string
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-11-27 18:13:02 +02:00
Kirill Bulatov
b2e6ca46ca Profile completions better 2020-11-27 18:00:03 +02:00
bors[bot]
c66d477f5a
Merge #6648
6648: Avoid allocation in ast::String::value if the string needs no unescaping r=lnicola a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-27 11:14:14 +00:00
Lukas Wirth
347da74eda Avoid allocation in ast::String::value if the string needs no unescaping 2020-11-27 12:03:58 +01:00
bors[bot]
572081f1c4
Merge #6586
6586: Don't call a closure a function in the infer_function_return_type assist label r=lnicola a=Veykril

`Add this function's return type` becomes `Add this closure's return type` for closures. This makes it more obvious that we are indeed planning on modifying the closure and not its containing function.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-27 09:49:37 +00:00
bors[bot]
bb2c6ceee7
Merge #6646
6646: Remove single r#trait identifer usage r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-26 20:50:16 +00:00
Lukas Wirth
6501c9445e Don't use raw identifiers 2020-11-26 21:44:17 +01:00
bors[bot]
fc0354b280
Merge #6635
6635: Complete struct in irrefutable let r=Veykril a=Veykril

Fixes #6210

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-26 20:30:16 +00:00
Lukas Wirth
ee06c07f50 Complete struct in irrefutable let 2020-11-26 21:28:43 +01:00
bors[bot]
38d595c36f
Merge #6644
6644: Simplify error formatting r=lnicola a=lnicola

CC jonas-schievink

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-11-26 19:18:40 +00:00
Laurențiu Nicola
3aca697511 Simplify error formatting 2020-11-26 21:07:15 +02:00
bors[bot]
deb3550fea
Merge #6643
6643: Remove unused import r=lnicola a=lnicola

Not sure why CI didn't catch this...

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-11-26 17:28:43 +00:00
Laurențiu Nicola
a5477d7f29 Remove unused import 2020-11-26 19:25:59 +02:00
bors[bot]
3a96c29028
Merge #6641
6641: Fix def map volatility with `#[cfg]` diagnostics r=jonas-schievink a=jonas-schievink

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 16:30:05 +00:00
Jonas Schievink
519d870c11 Don't store SyntaxNodePtr in CrateDefMap
It is volatile across reparses and makes incrementality worse.
2020-11-26 17:29:09 +01:00
Jonas Schievink
74cb3e96a5 Test def map invalidation with #[cfg] below change 2020-11-26 17:28:00 +01:00
bors[bot]
ad343870ec
Merge #6640
6640: Implement `Display` for macro expansion errors r=jonas-schievink a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 15:56:58 +00:00
Jonas Schievink
2c85db8eb6 Implement Display for macro expansion errors 2020-11-26 16:56:22 +01:00
bors[bot]
db061fb274
Merge #6639
6639: Use `ExpandResult` instead of `MacroResult` r=jonas-schievink a=jonas-schievink

`MacroResult` is redundant.

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 15:48:58 +00:00
Jonas Schievink
6a9338e979 Use ExpandResult instead of MacroResult
`MacroResult` is redundant
2020-11-26 16:48:17 +01:00
bors[bot]
1542797284
Merge #6638
6638: Use named fields in `ExpandResult` r=jonas-schievink a=jonas-schievink

bors r+ 🤖 

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 15:05:09 +00:00
Jonas Schievink
c784c8ec76 Use named fields in ExpandResult 2020-11-26 16:04:23 +01:00
bors[bot]
0bcd8147ec
Merge #6637
6637: Publish diagnostics on file open r=jonas-schievink a=jonas-schievink

Diagnostics are sometimes only showing up when typing. This should fix that.

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 12:42:29 +00:00
Jonas Schievink
9ed883f373 Publish diagnostics on file open
Diagnostics are sometimes only showing up when typing.
This should fix that.
2020-11-26 13:33:47 +01:00
bors[bot]
db6988d4e7
Merge #6614 #6632
6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore

Presumably closes https://github.com/rust-analyzer/rust-analyzer/issues/6594
May help https://github.com/rust-analyzer/rust-analyzer/issues/6612

* Ignore modules eaferly
* Do less completion string rendering

6632: Pin cargo_metadata r=matklad a=kjeremy

See: https://github.com/oli-obk/cargo_metadata/pull/142#issuecomment-733653275

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-26 10:43:35 +00:00
bors[bot]
ed5c1753b3
Merge #6496
6496: Use builtin scopes more r=matklad a=georgewfraser

VSCode has added more builtin fallback scopes, so we can remove some of our fallback scopes by aligning with their conventions. 

Note that the macro scope doesn't seem to actually *work* at the moment. I have filed a bug with VSCode: https://github.com/microsoft/vscode/issues/110150

Co-authored-by: George Fraser <george@fivetran.com>
2020-11-26 10:36:26 +00:00
George Fraser
ac314f88c6 Just remove the macro fallback 2020-11-25 08:41:40 -08:00
kjeremy
9a3142664b Pin cargo_metadata 2020-11-25 10:11:53 -05:00
bors[bot]
9b512f8569
Merge #6631
6631: Gate autoimports begind experimental completions flag r=kjeremy a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/6612

Adds a possibility to disable autoimports:

<img width="598" alt="image" src="https://user-images.githubusercontent.com/2690773/100156673-f8037f80-2eb1-11eb-8e74-59ebe4260ba3.png">

and other experimental completions we might want to add later.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-11-24 23:40:05 +00:00
Kirill Bulatov
9812150047 Document experimental completions 2020-11-25 00:42:58 +02:00
Kirill Bulatov
4c95c6e25d Gate autoimports begind experimental completions flag 2020-11-25 00:30:28 +02:00
bors[bot]
5478aaebfe
Merge #6630
6630: followup to "hir_expand: propagate expansion errors" r=jonas-schievink a=jonas-schievink

https://github.com/rust-analyzer/rust-analyzer/pull/6625

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-24 21:01:33 +00:00
Jonas Schievink
9559bce311 Rename parse_macro to parse_macro_expansion
This does not parse macros, it expands a macro and parses the *result*
2020-11-24 21:57:51 +01:00
Jonas Schievink
f9d0d51101 hir_expand::db: reduce fn visibility 2020-11-24 21:55:08 +01:00
Jonas Schievink
9a3bb19d32 Remove fixed FIXME, propagate errors better 2020-11-24 21:52:19 +01:00
bors[bot]
e2d8e1120f
Merge #6625
6625: hir_expand: propagate expansion errors r=jonas-schievink a=jonas-schievink

This is needed to collect and report expansion errors later.

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-24 18:01:49 +00:00
Jonas Schievink
d5e9bf80f9 hir_expand: propagate expansion errors 2020-11-24 19:00:23 +01:00
bors[bot]
d2f398cd76
Merge #6624
6624: Check structs for match exhaustiveness r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 17:51:46 +00:00
Lukas Wirth
377fa7db3f Check structs for match exhaustiveness 2020-11-24 18:50:56 +01:00
bors[bot]
b769f5da6e
Merge #6621
6621: Handle ellipsis in tuple patterns in match exhaustiveness checking r=flodiebold a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 15:57:32 +00:00
Lukas Wirth
4d841dc4e7 Add middle ellipsis missing arm text 2020-11-24 16:46:06 +01:00
Lukas Wirth
a4b5275656 Handle ellipsis in tuple patterns in match exhaustiveness checking 2020-11-24 16:43:28 +01:00
bors[bot]
67d45851bf
Merge #6618
6618: Properly infer tuple patterns when encountering ellipsis r=Veykril a=Veykril

We basically just split the subpatterns into two halves when the ellipsis is present and then offset the latter half to account for the ignored bindings.

Fixes #6616

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 15:13:25 +00:00
Lukas Wirth
a5efefd3d7 Properly infer tuple struct patterns when encountering ellipsis 2020-11-24 16:11:40 +01:00
bors[bot]
f7e63bdf91
Merge #6620
6620: cargo update (without cargo_metadata) r=kjeremy a=kjeremy

This is a `cargo update` run without updating `cargo_metadata`.

`cargo_metadata` `0.12.1` pins `semver-parser` to `0.10.0` (4e88e5624c) which brings back the compile time blowup that @matklad tried so hard to avoid in https://github.com/steveklabnik/semver-parser/pull/50.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-24 15:00:54 +00:00