]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agocargo update
kjeremy [Fri, 8 Jan 2021 14:37:28 +0000 (09:37 -0500)]
cargo update

3 years agoSupport intra_doc links
Daiki Ihara [Sat, 19 Dec 2020 13:12:51 +0000 (22:12 +0900)]
Support intra_doc links

3 years agosupport folder rename for initial request.
ShuiRuTian [Fri, 8 Jan 2021 09:49:13 +0000 (17:49 +0800)]
support folder rename for initial request.

3 years agoAdd check for dbg! macro
Edwin Cheng [Mon, 28 Dec 2020 03:27:54 +0000 (11:27 +0800)]
Add check for dbg! macro

3 years agoRemove unused dbg
Edwin Cheng [Sun, 27 Dec 2020 17:21:41 +0000 (01:21 +0800)]
Remove unused dbg

3 years agoUse another name instead of dbg for test
Edwin Cheng [Sun, 27 Dec 2020 17:20:44 +0000 (01:20 +0800)]
Use another name instead of dbg for test

3 years agoMerge #7205
bors[bot] [Fri, 8 Jan 2021 06:03:54 +0000 (06:03 +0000)]
Merge #7205

7205: Fix bug for $crate in LHS of mbe r=edwin0cheng a=edwin0cheng

We treated `$crate` as meta variable in LHS of mbe, which should be an `ident`.

Fixes #7204

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
3 years agoAdd test
Edwin Cheng [Fri, 8 Jan 2021 06:00:23 +0000 (14:00 +0800)]
Add test

3 years agoFix bug when $crate in LHS in mbe
Edwin Cheng [Fri, 8 Jan 2021 06:00:16 +0000 (14:00 +0800)]
Fix bug when $crate in LHS in mbe

3 years agoMerge #7145
bors[bot] [Fri, 8 Jan 2021 03:57:11 +0000 (03:57 +0000)]
Merge #7145

7145: Proper handling $crate Take 2 [DO NOT MERGE] r=edwin0cheng a=edwin0cheng

Similar to previous PR (#7133) , but improved the following things :

1. Instead of storing the whole `ExpansionInfo`, we store a similar but stripped version `HygieneInfo`.
2. Instread of storing the `SyntaxNode` (because every token we are interested are IDENT), we store the `TextRange` only.
3. Because of 2, we now can put it in Salsa.
4. And most important improvement: Instead of computing the whole frames every single time, we compute it recursively through salsa: (Such that in the best scenario, we only need to compute the first layer of frame)

```rust
        let def_site = db.hygiene_frame(info.def.file_id);
        let call_site = db.hygiene_frame(info.arg.file_id);

        HygieneFrame { expansion: Some(info), local_inner, krate, call_site, def_site }
```

The overall speed compared to previous PR is much faster (65s vs 45s) :
```
[WITH old PR]
Database loaded 644.86ms, 284mi
Crates in this dir: 36
Total modules found: 576
Total declarations: 11153
Total functions: 8715
Item Collection: 15.78s, 91562mi
Total expressions: 240721
Expressions of unknown type: 2635 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 865
Inference: 49.84s, 250747mi
Total: 65.62s, 342310mi
rust-analyzer -q analysis-stats .  66.72s user 0.57s system 99% cpu 1:07.40 total

[WITH this PR]
Database loaded 665.83ms, 284mi
Crates in this dir: 36
Total modules found: 577
Total declarations: 11188
Total functions: 8743
Item Collection: 15.28s, 84919mi
Total expressions: 241229
Expressions of unknown type: 2637 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 868
Inference: 30.15s, 135293mi
Total: 45.43s, 220213mi
rust-analyzer -q analysis-stats .  46.26s user 0.74s system 99% cpu 47.294 total
```

*HOWEVER*,  it is still a perf regression (35s vs 45s):
```
[WITHOUT this PR]
Database loaded 657.42ms, 284mi
Crates in this dir: 36
Total modules found: 577
Total declarations: 11177
Total functions: 8735
Item Collection: 12.87s, 72407mi
Total expressions: 239380
Expressions of unknown type: 2643 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 868
Inference: 22.88s, 97889mi
Total: 35.74s, 170297mi
rust-analyzer -q analysis-stats .  36.71s user 0.63s system 99% cpu 37.498 total
```

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
3 years agoMerge #7201
bors[bot] [Thu, 7 Jan 2021 23:12:26 +0000 (23:12 +0000)]
Merge #7201

7201: Simplify some matches in completions modules r=matklad a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoSimplify mod completion
Lukas Wirth [Thu, 7 Jan 2021 22:33:52 +0000 (23:33 +0100)]
Simplify mod completion

3 years agoTidy up attribute completion match
Lukas Wirth [Thu, 7 Jan 2021 21:48:54 +0000 (22:48 +0100)]
Tidy up attribute completion match

3 years agoMerge #7097
bors[bot] [Thu, 7 Jan 2021 19:53:05 +0000 (19:53 +0000)]
Merge #7097

7097: Add fix to wrap return expression in Some r=matklad a=theotherphil

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

Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
3 years agoSwitch test marker
Phil Ellison [Thu, 7 Jan 2021 18:43:40 +0000 (18:43 +0000)]
Switch test marker

3 years agocargo fmt
Phil Ellison [Wed, 30 Dec 2020 17:33:33 +0000 (17:33 +0000)]
cargo fmt

3 years agoAdd fix to wrap return expression in Some
Phil Ellison [Wed, 30 Dec 2020 17:23:00 +0000 (17:23 +0000)]
Add fix to wrap return expression in Some

3 years agoMerge #7199
bors[bot] [Thu, 7 Jan 2021 18:16:43 +0000 (18:16 +0000)]
Merge #7199

7199: typo r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMerge #7193
bors[bot] [Thu, 7 Jan 2021 18:07:01 +0000 (18:07 +0000)]
Merge #7193

7193: Show progress for fetching workspace (cargo-metadata and loadOutDirsFromCheck) r=matklad a=edwin0cheng

![Peek 2021-01-07 21-57](https://user-images.githubusercontent.com/11014119/103902132-0db4c780-5135-11eb-94d3-32429445be87.gif)

Fixes #7188
Fixes #3300

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
3 years agoMerge #7191
bors[bot] [Thu, 7 Jan 2021 17:57:48 +0000 (17:57 +0000)]
Merge #7191

7191: Adjust vfs crate documentation r=matklad a=arnaudgolfouse

This removes an outdated comment, and uses intra-doc links

Co-authored-by: Arnaud <arnaud.golfouse@free.fr>
3 years agotypo
Aleksey Kladov [Thu, 7 Jan 2021 17:27:22 +0000 (20:27 +0300)]
typo

3 years agoReport progress for cargo metadata and output-dir
Edwin Cheng [Thu, 7 Jan 2021 17:08:46 +0000 (01:08 +0800)]
Report progress for cargo metadata and output-dir

3 years agoMerge #7198
bors[bot] [Thu, 7 Jan 2021 17:12:54 +0000 (17:12 +0000)]
Merge #7198

7198: Styleguide readability r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoStyleguide readability
Aleksey Kladov [Thu, 7 Jan 2021 17:11:55 +0000 (20:11 +0300)]
Styleguide readability

3 years agoRefactor out JodChild
Edwin Cheng [Thu, 7 Jan 2021 17:08:34 +0000 (01:08 +0800)]
Refactor out JodChild

3 years agoMerge #7197
bors[bot] [Thu, 7 Jan 2021 16:28:43 +0000 (16:28 +0000)]
Merge #7197

7197: Document `std::ops` style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoDocument `std::ops` style
Aleksey Kladov [Thu, 7 Jan 2021 16:27:47 +0000 (19:27 +0300)]
Document `std::ops` style

3 years agoMerge #7196
bors[bot] [Thu, 7 Jan 2021 16:11:54 +0000 (16:11 +0000)]
Merge #7196

7196: Better fixture highlight r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoBetter fixture highlight
Aleksey Kladov [Thu, 7 Jan 2021 15:21:00 +0000 (18:21 +0300)]
Better fixture highlight

3 years agoMerge #7195
bors[bot] [Thu, 7 Jan 2021 15:30:23 +0000 (15:30 +0000)]
Merge #7195

7195: Update remaining serverPath references r=lnicola a=lnicola

Fixes https://github.com/rust-analyzer/rust-analyzer/pull/7156#issuecomment-755487667

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoUpdate remaining serverPath references
Laurențiu Nicola [Thu, 7 Jan 2021 15:06:11 +0000 (17:06 +0200)]
Update remaining serverPath references

3 years agoMerge #7194
bors[bot] [Thu, 7 Jan 2021 14:39:50 +0000 (14:39 +0000)]
Merge #7194

7194: Don't update the server if managed by the user r=matklad a=lnicola

Fixes #7187

CC @figsoda

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoDon't update the server if managed by the user
Laurențiu Nicola [Thu, 7 Jan 2021 14:33:00 +0000 (16:33 +0200)]
Don't update the server if managed by the user

3 years agoMerge #7184
bors[bot] [Thu, 7 Jan 2021 12:27:17 +0000 (12:27 +0000)]
Merge #7184

7184: Changes Cursor Marker To $0 r=matklad a=kevaundray

Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
3 years agoChange <|> to $0 - Rebase
Kevaundray Wedderburn [Wed, 6 Jan 2021 20:15:48 +0000 (20:15 +0000)]
Change <|> to $0 - Rebase

3 years agoMerge #7192
bors[bot] [Thu, 7 Jan 2021 12:07:49 +0000 (12:07 +0000)]
Merge #7192

7192: Use american spelling for config r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoUse american spelling for config
Aleksey Kladov [Thu, 7 Jan 2021 11:37:38 +0000 (14:37 +0300)]
Use american spelling for config

As per

https://github.com/rust-analyzer/rust-analyzer/blob/171c3c08fe245938fb25321394233de5fe2abc7c/docs/dev/style.md#variable-naming

Also implement config aliasing, for pain-free settings migrations in the future

3 years agoUse `file_set::FileSet` and `FileSet` consistently in doc
Arnaud [Thu, 7 Jan 2021 11:18:25 +0000 (12:18 +0100)]
Use `file_set::FileSet` and `FileSet` consistently in doc

The first occurrence of `FileSet` has the full path (`file_set::FileSet`),
while every other is simply `FileSet`.

3 years agoUse intra-doc links in `vfs` crate documentation
Arnaud [Thu, 7 Jan 2021 11:08:11 +0000 (12:08 +0100)]
Use intra-doc links in `vfs` crate documentation

3 years agoRemove the reference to `WalkdirLoaderHandle` in vfs documentation
Arnaud [Thu, 7 Jan 2021 10:09:08 +0000 (11:09 +0100)]
Remove the reference to `WalkdirLoaderHandle` in vfs documentation

This structure was deleted in commit #dad1333

3 years agoMerge #7190
bors[bot] [Thu, 7 Jan 2021 10:54:44 +0000 (10:54 +0000)]
Merge #7190

7190: Remove some stale deprecations r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoRemove some stale deprecations
Aleksey Kladov [Thu, 7 Jan 2021 10:05:51 +0000 (13:05 +0300)]
Remove some stale deprecations

3 years agoMerge #7189
bors[bot] [Thu, 7 Jan 2021 09:01:48 +0000 (09:01 +0000)]
Merge #7189

7189: Extend git evacuation procedure r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoExtend git evacuation procedure
Aleksey Kladov [Thu, 7 Jan 2021 09:00:07 +0000 (12:00 +0300)]
Extend git evacuation procedure

3 years agoProper handling $crate Take 2
Edwin Cheng [Mon, 4 Jan 2021 02:53:31 +0000 (10:53 +0800)]
Proper handling $crate Take 2

3 years agoMerge #7186
bors[bot] [Wed, 6 Jan 2021 18:27:02 +0000 (18:27 +0000)]
Merge #7186

7186: Align config's API with usage r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoAlign config's API with usage
Aleksey Kladov [Wed, 6 Jan 2021 17:43:46 +0000 (20:43 +0300)]
Align config's API with usage

The config now is mostly immutable, optimize for that.

3 years agoMerge #7183
bors[bot] [Wed, 6 Jan 2021 17:29:18 +0000 (17:29 +0000)]
Merge #7183

7183: YAGNI active_resolve_capabilities r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoYAGNI active_resolve_capabilities
Aleksey Kladov [Wed, 6 Jan 2021 17:23:53 +0000 (20:23 +0300)]
YAGNI active_resolve_capabilities

This leaks a lot of LSP details into ide layer, which we want to avoid:

https://github.com/rust-analyzer/rust-analyzer/tree/c9cec381bcfd97e5f3536e31a9c546ab5c0665e6/docs/dev#lsp-independence

Additionally, all what this infra does is providing a toggle for
auto-import completion, but we already have one!

3 years agoMerge #7182
bors[bot] [Wed, 6 Jan 2021 17:16:04 +0000 (17:16 +0000)]
Merge #7182

7182: Replace last usages of difference with dissimilar r=matklad a=Jesse-Bakker

Co-authored-by: Jesse Bakker <github@jessebakker.com>
3 years agoReplace last usages of difference with dissimilar
Jesse Bakker [Wed, 6 Jan 2021 17:13:29 +0000 (18:13 +0100)]
Replace last usages of difference with dissimilar

3 years agoMerge #7181
bors[bot] [Wed, 6 Jan 2021 16:41:22 +0000 (16:41 +0000)]
Merge #7181

7181: Document project_model::PackageData and project_model::TargetData r=arnaudgolfouse a=arnaudgolfouse

This PR adds some documentation for the `project_model` crate.

Some of the field descriptions were taken directly from their `cargo_metadata` counterpart :
- `PackageData` -> `cargo_metadata::Package`
- `TargetData` -> `cargo_metadata::Target`

Co-authored-by: Arnaud <arnaud.golfouse@free.fr>
3 years agoDocument `project_model::TargetData`
Arnaud [Wed, 6 Jan 2021 15:39:44 +0000 (16:39 +0100)]
Document `project_model::TargetData`

This adds a description for `TargetData` and all its fields.

3 years agoDocument `project_model::PackageData`
Arnaud [Wed, 6 Jan 2021 15:39:19 +0000 (16:39 +0100)]
Document `project_model::PackageData`

This adds a description for `PackageData` and all its fields.

3 years agoMerge #7180
bors[bot] [Wed, 6 Jan 2021 15:36:37 +0000 (15:36 +0000)]
Merge #7180

7180: More readable test r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMore readable test
Aleksey Kladov [Wed, 6 Jan 2021 15:36:06 +0000 (18:36 +0300)]
More readable test

3 years agoMake `PackageData`, `TargetData` and `PackageDependency` public
Arnaud [Tue, 5 Jan 2021 18:02:13 +0000 (19:02 +0100)]
Make `PackageData`, `TargetData` and `PackageDependency` public

This makes them discoverable through documentation.
They were already publicly accessible through `Package` and `Target`.

3 years agoMerge #7179
bors[bot] [Wed, 6 Jan 2021 15:16:56 +0000 (15:16 +0000)]
Merge #7179

7179: Less confusing instr stat r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoLess confusing instr stat
Aleksey Kladov [Wed, 6 Jan 2021 15:16:04 +0000 (18:16 +0300)]
Less confusing instr stat

3 years agoMerge #7178
bors[bot] [Wed, 6 Jan 2021 13:33:25 +0000 (13:33 +0000)]
Merge #7178

7178: Better target for move module r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoBetter target for move module
Aleksey Kladov [Wed, 6 Jan 2021 13:24:47 +0000 (16:24 +0300)]
Better target for move module

3 years agoMerge #7177
bors[bot] [Wed, 6 Jan 2021 12:49:50 +0000 (12:49 +0000)]
Merge #7177

7177: Speed up snapshoting r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoSpeed up snapshoting
Aleksey Kladov [Wed, 6 Jan 2021 12:46:31 +0000 (15:46 +0300)]
Speed up snapshoting

Config can be fairly big, no need to deep clone it frequently

3 years agoMerge #7172
bors[bot] [Wed, 6 Jan 2021 12:40:34 +0000 (12:40 +0000)]
Merge #7172

7172: refactor config to be lossless & precise r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMore maintainable config
Aleksey Kladov [Wed, 6 Jan 2021 10:54:28 +0000 (13:54 +0300)]
More maintainable config

Rather than eagerly converting JSON, we losslessly keep it as is, and
change the shape of user-submitted data at the last moment.

This also allows us to remove a bunch of wrong Defaults

3 years agoMerge #7176
bors[bot] [Wed, 6 Jan 2021 11:32:53 +0000 (11:32 +0000)]
Merge #7176

7176: Attribute completion r=matklad a=FlowerBOII

Solve #7167.

I removed the optional args for the attributes ```deprecated```, ```must_use``` and ```should_panic```.
I also updated their respective tests.

Please let me know if I missed something.

Co-authored-by: FlowerBOII <42295129+FlowerBOII@users.noreply.github.com>
3 years agoChange the should_panic completion and his related attribute test
FlowerBOII [Wed, 6 Jan 2021 11:23:19 +0000 (12:23 +0100)]
Change the should_panic completion and his related attribute test

3 years agomore thoughts.
ShuiRuTian [Wed, 6 Jan 2021 11:12:44 +0000 (19:12 +0800)]
more thoughts.

3 years agoRemove the args for the must_use attibute and change the related tests
FlowerBOII [Wed, 6 Jan 2021 11:04:23 +0000 (12:04 +0100)]
Remove the args for the must_use attibute and change the related tests

3 years agoUpdate deprecated test
FlowerBOII [Wed, 6 Jan 2021 10:07:57 +0000 (11:07 +0100)]
Update deprecated test

3 years agoRemove a part of the deprecated autocompletion
FlowerBOII [Wed, 6 Jan 2021 10:06:02 +0000 (11:06 +0100)]
Remove a part of the deprecated autocompletion

3 years agoMerge #7174
bors[bot] [Wed, 6 Jan 2021 09:03:38 +0000 (09:03 +0000)]
Merge #7174

7174: Normalize line endings when formatting r=matklad a=Jesse-Bakker

Fixes #7166

Co-authored-by: Jesse Bakker <github@jessebakker.com>
3 years agoadd analytics md.
ShuiRuTian [Wed, 6 Jan 2021 08:01:48 +0000 (16:01 +0800)]
add analytics md.

3 years agoNormalize line endings when formatting
Jesse Bakker [Tue, 5 Jan 2021 21:29:53 +0000 (22:29 +0100)]
Normalize line endings when formatting

3 years agoMerge #7170
bors[bot] [Tue, 5 Jan 2021 14:52:21 +0000 (14:52 +0000)]
Merge #7170

7170: More maintainable caps config r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMore maintainable caps config
Aleksey Kladov [Tue, 5 Jan 2021 13:57:05 +0000 (16:57 +0300)]
More maintainable caps config

The idea here is that we preserve client's config as is, without
changes. This gets rid of state!

3 years agoMerge #7171
bors[bot] [Tue, 5 Jan 2021 14:46:47 +0000 (14:46 +0000)]
Merge #7171

7171: Emit diagnostics for unresolved item-level macros r=jonas-schievink a=jonas-schievink

We have been emitting macro *expansion* errors for macro calls in item position, as well as expansion and resolution errors for macro calls in bodies. This fills in the last gap, which is *resolution* errors for macro calls in item position (ie. those that name resolution cares about).

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoEmit diagnostics for unresolved item-level macros
Jonas Schievink [Tue, 5 Jan 2021 14:42:43 +0000 (15:42 +0100)]
Emit diagnostics for unresolved item-level macros

3 years agoMerge #7168
bors[bot] [Tue, 5 Jan 2021 12:51:38 +0000 (12:51 +0000)]
Merge #7168

7168: Rename expr -> tail_expr r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoRename expr -> tail_expr
Aleksey Kladov [Tue, 5 Jan 2021 12:45:46 +0000 (15:45 +0300)]
Rename expr -> tail_expr

3 years agoMerge #7140
bors[bot] [Tue, 5 Jan 2021 12:04:35 +0000 (12:04 +0000)]
Merge #7140

7140: Store trait associated items in fst r=matklad a=SomeoneToIgnore

Store imported traits' associated function/methods and constants into `ImportMap.fst` and pefrorm the imports search on them.

This is a first step towards trait autoimport during completion functionality, the way I see it, after this PR, only a few major things are left to be done:

* store all traits' assoc items into fst, not only the ones in scope, as we do now. Any code pointers on how to do this are welcome 😄
* adjust a few modules in completions crate (`dot.rs`, `qualified_path.rs` at least) to query the import map, reusing the `import_assets` logic heavily

==
With the current import and autoimport implementations, it looks like for a single query, we're either interested in either associated items lookup or in all other `fst` contents lookup, but never both simultaneously.
I would rather not split `fst` in two but add another `Query` parameter to separate those, but let me know if you have any ideas.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoMove the test mark
Kirill Bulatov [Tue, 5 Jan 2021 12:03:58 +0000 (14:03 +0200)]
Move the test mark

3 years agoMerge #7131
bors[bot] [Tue, 5 Jan 2021 11:04:58 +0000 (11:04 +0000)]
Merge #7131

7131: Created an assist for inlining a function's body into its caller r=matklad a=Michael-F-Bryan

This introduces an `inline_function` assist which will convert code like this:

```rust
fn add(a: u32, b: u32) -> u32 { a + b }
fn main() {
    let x = add<|>(1, 2);
}
```

Into something like this:

```rust
fn add(a: u32, b: u32) -> u32 { a + b }
fn main() {
    let x = {
        let a = 1;
        let b = 2;
        a + b
    };
}
```

Fixes #6863.

Co-authored-by: Michael-F-Bryan <michaelfbryan@gmail.com>
3 years agoMerge #7162
bors[bot] [Tue, 5 Jan 2021 10:53:24 +0000 (10:53 +0000)]
Merge #7162

7162: Introduce queries to avoid problems when performing completion for enums with many variants r=matklad a=danielframpton

This change introduces two new queries to compute:
  1) attributes for all variants of an enum, and
  2) attributes for all fields of a variant.

The purpose of this change is to avoid the current n^2 behavior when rendering completion for variants (which prevents completion for enums with large numbers of variants).

Co-authored-by: Daniel Frampton <Daniel.Frampton@microsoft.com>
3 years agoMerge #7164
bors[bot] [Tue, 5 Jan 2021 10:10:45 +0000 (10:10 +0000)]
Merge #7164

7164: Allow `#anchor` linking of config options r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoAllow `#anchor` linking of config options
Aleksey Kladov [Tue, 5 Jan 2021 10:09:06 +0000 (13:09 +0300)]
Allow `#anchor` linking of config options

3 years agoMerge #7163
bors[bot] [Tue, 5 Jan 2021 09:32:34 +0000 (09:32 +0000)]
Merge #7163

7163: Use macos-latest for aarch64-apple-darwin releases r=lnicola a=lnicola

Our builds get queued for 40-50 minutes waiting for a `macos-11.0` runner, let's keep using the older OS.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoUse macos-latest for aarch64-apple-darwin releases
Laurențiu Nicola [Tue, 5 Jan 2021 09:15:12 +0000 (11:15 +0200)]
Use macos-latest for aarch64-apple-darwin releases

3 years agoIntroduce new queries to compute
Daniel Frampton [Mon, 4 Jan 2021 20:56:21 +0000 (12:56 -0800)]
Introduce new queries to compute
  1) the set of attributes for all variants of an enum, and
  2) the set of attributes for all fields of a variant.

This avoids the current n^2 behavior when rendering completion for variants, which
prevents completion for enums with large numbers of variants.

3 years agoMerge #7161
bors[bot] [Mon, 4 Jan 2021 22:03:35 +0000 (22:03 +0000)]
Merge #7161

7161: Cargo update to remove some dependencies r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoCargo update to remove some dependencies
kjeremy [Mon, 4 Jan 2021 22:02:16 +0000 (17:02 -0500)]
Cargo update to remove some dependencies

3 years agoMerge #7160
bors[bot] [Mon, 4 Jan 2021 21:07:50 +0000 (21:07 +0000)]
Merge #7160

7160: Get `hir::Function` return type r=flodiebold a=arnaudgolfouse

Hello !

As said in #7158, I noticed that `hir::Function` has no direct way of getting the return type, so this PR adds this functionality.

Co-authored-by: Arnaud <arnaud.golfouse@free.fr>
3 years agoMerge #7147
bors[bot] [Mon, 4 Jan 2021 20:36:13 +0000 (20:36 +0000)]
Merge #7147

7147: ssr: Allow replacing expressions with statements r=davidlattimore a=MarijnS95

Depends on #6587

Until that is merged, the diff is https://github.com/MarijnS95/rust-analyzer/compare/stmt..replace-expr-with-stmt

---

Now that statements can be matched and replaced (#6587) some usecases require expressions to be replaced with statements as well. This happens when something that can ambiguously be an expression or statement like `if` and loop blocks appear in the last position of a block, as trailing expression. In this case a replacement pattern of the form `if foo(){$a();}==>>$a();` will only substitute `if` blocks in the list of statements but not if they (implicitly) end up in the trailing expression, where they are not wrapped by an EXPR_STMT (but the pattern and template are, as parsing only succeeds for the `stmt ==>> stmt` case).

Instead of adding two rules that match an expression - and emit duplicate matching errors - allow the template for expressions to be a statement if it fails to parse as an expression.

---

Another gross change that does not seem to break any tests currently, but perhaps a safeguard should be added to only allow this kind of replacement in blocks by "pushing" the replacement template to the statement list and clearing the trailing expression?

CC @davidlattimore

Co-authored-by: Marijn Suijten <marijn@traverseresearch.nl>
3 years agoCreated an inline-function assist (fixes #6863)
Michael-F-Bryan [Sat, 2 Jan 2021 05:47:35 +0000 (13:47 +0800)]
Created an inline-function assist (fixes #6863)

3 years agoSmall helpers
Kirill Bulatov [Mon, 4 Jan 2021 20:01:35 +0000 (22:01 +0200)]
Small helpers

3 years agoRemove `RetType`
Arnaud [Mon, 4 Jan 2021 19:34:23 +0000 (20:34 +0100)]
Remove `RetType`

3 years agoDocument `hir::Function::ret_type`
Arnaud [Mon, 4 Jan 2021 17:59:37 +0000 (18:59 +0100)]
Document `hir::Function::ret_type`

This adds documentation for the newly added function. It might be a bit too
detailed, but I like it that way :)

3 years agoMake it possible to retrieve `hir::Function`'s return type
Arnaud [Mon, 4 Jan 2021 17:58:42 +0000 (18:58 +0100)]
Make it possible to retrieve `hir::Function`'s return type

This is done by adding a `ret_type` method to `hir::Function`.
I followed `assoc_fn_params` convention by creating a new `RetType` type,
that contains the actual return type accessible via a `ty` method.

3 years agoMerge #7159
bors[bot] [Mon, 4 Jan 2021 18:02:54 +0000 (18:02 +0000)]
Merge #7159

7159: Refactor mbe to reduce clone and copying r=edwin0cheng a=edwin0cheng

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
3 years agoSimplify SubtreeTokenSource
Edwin Cheng [Mon, 4 Jan 2021 17:50:34 +0000 (01:50 +0800)]
Simplify SubtreeTokenSource