]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUpdate manual.adoc
Dorian Peake [Sun, 5 Sep 2021 15:59:38 +0000 (16:59 +0100)]
Update manual.adoc

2 years agoAdd rust-project.json + cargo check info to docs
Dorian Peake [Sun, 5 Sep 2021 15:32:05 +0000 (16:32 +0100)]
Add rust-project.json + cargo check info to docs

Add information about how to configure compilation errors/checks when using rust-project.json.

2 years agoMerge #10148
bors[bot] [Sat, 4 Sep 2021 17:35:12 +0000 (17:35 +0000)]
Merge #10148

10148: docs: make dev docs more discoverable r=matklad a=matklad

I *think* people might try to debug ra by using only the troubleshooting
section. Might make sense to point them to dev docs then!

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agono need to reed the docs, feel free to charge ahead!
Aleksey Kladov [Sat, 4 Sep 2021 17:34:17 +0000 (20:34 +0300)]
no need to reed the docs, feel free to charge ahead!

But knowing where the docs are is useful ;)

2 years agodocs: make dev docs more discoverable
Aleksey Kladov [Sat, 4 Sep 2021 17:17:28 +0000 (20:17 +0300)]
docs: make dev docs more discoverable

I *think* people might try to debug ra by using only the troubleshooting
section. Might make sense to point them to dev docs then!

2 years agoMerge #10146
bors[bot] [Sat, 4 Sep 2021 14:04:30 +0000 (14:04 +0000)]
Merge #10146

10146: fix: use placeholder as default type in `Generate function` and `Extract into function`. r=matklad a=iDawer

Closes #10123

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2 years agoMerge #10147
bors[bot] [Sat, 4 Sep 2021 13:56:47 +0000 (13:56 +0000)]
Merge #10147

10147: fix: don't panic if the client sends invalid request r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: deduplicate
Aleksey Kladov [Sat, 4 Sep 2021 09:56:34 +0000 (12:56 +0300)]
internal: deduplicate

2 years agominor: update test
Dawer [Sat, 4 Sep 2021 10:19:44 +0000 (15:19 +0500)]
minor: update test

2 years agofix: don't panic if the client sends invalid request
Aleksey Kladov [Sat, 4 Sep 2021 09:27:27 +0000 (12:27 +0300)]
fix: don't panic if the client sends invalid request

2 years agofix: use placeholder as default type in `Extract into function`.
Dawer [Sat, 4 Sep 2021 09:21:14 +0000 (14:21 +0500)]
fix: use placeholder as default type in `Extract into function`.

2 years agofix: use placeholder as default type in `Generate function`.
Dawer [Sat, 4 Sep 2021 08:43:36 +0000 (13:43 +0500)]
fix: use placeholder as default type in `Generate function`.

2 years agoMerge #10145
bors[bot] [Sat, 4 Sep 2021 07:29:50 +0000 (07:29 +0000)]
Merge #10145

10145: Update dependency minor versions
 r=lnicola a=lf-

bors r+
🤖

Co-authored-by: Jade <software@lfcode.ca>
2 years agoUpdate dependency minor versions
Jade [Sat, 4 Sep 2021 07:17:36 +0000 (00:17 -0700)]
Update dependency minor versions

2 years agoMerge #10139
bors[bot] [Fri, 3 Sep 2021 18:03:52 +0000 (18:03 +0000)]
Merge #10139

10139: Fix replacing for loops over ranges with for_each. r=yotamofek a=yotamofek

Previously, the assist would turn this:
```rust
for x in 0..92 {
    ...
}
```
into the syntactically incorrect code below:
```rust
0..92.for_each(|x| ...)
```

This fixes the assist by parenthesizing range expressions.

Co-authored-by: Yotam Ofek <yotam.ofek@gmail.com>
2 years agoUpdate crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs
Yotam Ofek [Fri, 3 Sep 2021 18:02:48 +0000 (21:02 +0300)]
Update crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoMerge #10130
bors[bot] [Fri, 3 Sep 2021 17:49:23 +0000 (17:49 +0000)]
Merge #10130

10130: fix error message for when DidChangeTextDocument path doesn't exist r=matklad a=alidn

Fixes #10129

Co-authored-by: Ali <59405723+alidn@users.noreply.github.com>
2 years agoFix replacing for loops over ranges with for_each.
Yotam Ofek [Fri, 3 Sep 2021 16:43:40 +0000 (19:43 +0300)]
Fix replacing for loops over ranges with for_each.

2 years agoMerge #10135
bors[bot] [Fri, 3 Sep 2021 14:28:27 +0000 (14:28 +0000)]
Merge #10135

10135: minor: fix some clippy lints r=lnicola a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: fix some clippy lints
Lukas Wirth [Fri, 3 Sep 2021 14:00:50 +0000 (16:00 +0200)]
minor: fix some clippy lints

2 years agoMerge #10132
bors[bot] [Fri, 3 Sep 2021 09:25:29 +0000 (09:25 +0000)]
Merge #10132

10132: docs(logging): use `tracing` for logging r=matklad a=dzvon

Currently, we're using `tracing` for logging, but the doc is lagging, so update it.

#9274

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2 years agodocs(logging): use `tracing` for logging
Dezhi Wu [Fri, 3 Sep 2021 09:07:38 +0000 (17:07 +0800)]
docs(logging): use `tracing` for logging

2 years agofix error message for when DidChangeTextDocument path doesn't exist
Ali [Thu, 2 Sep 2021 22:19:47 +0000 (15:19 -0700)]
fix error message for when DidChangeTextDocument path doesn't exist

2 years agoMerge #10127
bors[bot] [Thu, 2 Sep 2021 17:14:23 +0000 (17:14 +0000)]
Merge #10127

10127: fix: When descending tokens don't bail on failed macro call expansions r=Veykril a=Veykril

(with `#[test]` expansion enabled)
![image](https://user-images.githubusercontent.com/3757771/131887786-ced9988b-80fa-4e8f-b114-337572950cc3.png)

The problem was pretty simple, since we go through the ancestors we first try to expand the macro call node we are in since in attributed items these are valid syntaxnodes instead of TokenTrees, we then fail the expansion since the expansion only exists in the attribute expanded file and therefor skip the attribute expansion due to returning immediately. So instead of breaking out we just continue looking up the ancestors.

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoWhen descending tokens don't bail on failed macro call expansions
Lukas Wirth [Thu, 2 Sep 2021 17:10:40 +0000 (19:10 +0200)]
When descending tokens don't bail on failed macro call expansions

2 years agoMerge #10124
bors[bot] [Thu, 2 Sep 2021 15:32:10 +0000 (15:32 +0000)]
Merge #10124

10124: fix: Use correct search scopes for macros r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUse correct search scopes for macros
Lukas Wirth [Thu, 2 Sep 2021 15:30:02 +0000 (17:30 +0200)]
Use correct search scopes for macros

2 years agoMerge #10114
bors[bot] [Wed, 1 Sep 2021 19:53:10 +0000 (19:53 +0000)]
Merge #10114

10114: fix: Deduplicate imports for qualify_path r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDeduplicate imports for qualify_path
Lukas Wirth [Wed, 1 Sep 2021 19:51:28 +0000 (21:51 +0200)]
Deduplicate imports for qualify_path

2 years agoMerge #10103
bors[bot] [Wed, 1 Sep 2021 17:21:05 +0000 (17:21 +0000)]
Merge #10103

10103: fix: make "find references" multi-token mapping aware r=jonas-schievink a=jonas-schievink

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

I was hoping that this would fix "find references" on salsa queries, but salsa emits multiple defs sharing the same span (the trait method, and an impl of that trait).

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agofix: multi-token mapping aware find references
Jonas Schievink [Wed, 1 Sep 2021 16:17:32 +0000 (18:17 +0200)]
fix: multi-token mapping aware find references

2 years agoMerge #10109
bors[bot] [Wed, 1 Sep 2021 14:17:47 +0000 (14:17 +0000)]
Merge #10109

10109: fix: Enable flyimport for ident patterns r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoEnable flyimport for ident patterns
Lukas Wirth [Wed, 1 Sep 2021 14:13:53 +0000 (16:13 +0200)]
Enable flyimport for ident patterns

2 years agoMerge #10108
bors[bot] [Wed, 1 Sep 2021 12:52:29 +0000 (12:52 +0000)]
Merge #10108

10108: fix: make `goto_implementation` multi-token mapping aware r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: make `goto_implementation` multi-token mapping aware
Lukas Wirth [Wed, 1 Sep 2021 12:51:37 +0000 (14:51 +0200)]
fix: make `goto_implementation` multi-token mapping aware

2 years agoMerge #9954
bors[bot] [Wed, 1 Sep 2021 09:26:10 +0000 (09:26 +0000)]
Merge #9954

9954: feat: Show try operator propogated types on ranged hover  r=matklad a=Veykril

Basically this just shows the type of the inner expression of the `?` expression as well as the type of the expression that the `?` returns from:
![Code_wIrCxMqLH9](https://user-images.githubusercontent.com/3757771/130111025-f7ee0742-214a-493b-947a-b4a671e4be92.png)

Unless both of these types are `core::result::Result` in which case we show the error types only.
![Code_Xruw5FCBNI](https://user-images.githubusercontent.com/3757771/130111024-f9caef82-92e4-4070-b3dd-f2ff9e5d87a9.png)

If both types are `core::option::Option` with different type params we do not show this special hover either as it would be pointless(instead fallback to default type hover)

Very much open to changes to the hover text here(I suppose we also want to show the actual type of the `?` expression, that is its output type?).

Fixes #9931

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMinor fixes
Lukas Wirth [Wed, 1 Sep 2021 09:25:42 +0000 (11:25 +0200)]
Minor fixes

2 years agoMerge #9405
bors[bot] [Wed, 1 Sep 2021 09:14:25 +0000 (09:14 +0000)]
Merge #9405

9405: Fix extract_function with macro arg r=Veykril a=sasurau4

## Overview

Fix #9266

Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2 years agoFix extract_function with macro arg
Daiki Ihara [Fri, 25 Jun 2021 13:14:42 +0000 (22:14 +0900)]
Fix extract_function with macro arg

2 years agoMerge #10101
bors[bot] [Tue, 31 Aug 2021 16:15:44 +0000 (16:15 +0000)]
Merge #10101

10101: internal: reduce coupling r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: reduce coupling
Aleksey Kladov [Tue, 31 Aug 2021 16:14:33 +0000 (19:14 +0300)]
internal: reduce coupling

tt is a data structure, data structures cant' go wrong, they shouldn't
have the knowledge that the world outside of them has all kinds of
errors.

2 years agoMerge #10100
bors[bot] [Tue, 31 Aug 2021 16:04:54 +0000 (16:04 +0000)]
Merge #10100

10100: internal: cleanup proc macro server error handlig r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: cleanup proc macro server error handlig
Aleksey Kladov [Tue, 31 Aug 2021 16:01:39 +0000 (19:01 +0300)]
internal: cleanup proc macro server error handlig

When dealing with proc macros, there are two very different kinds of
errors:

* first, usual errors of "proc macro panicked on this particular input"
* second, the proc macro server might day if the user, eg, kills it

First kind of errors are expected and are a normal output, while the
second kind are genuine IO-errors.

For this reason, we use a curious nested result here: `Result<Result<T,
E1>, E2>` pattern, which is 100% inspired by http://sled.rs/errors.html

2 years agoMerge #10099
bors[bot] [Tue, 31 Aug 2021 13:58:16 +0000 (13:58 +0000)]
Merge #10099

10099: minor: improve readability r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoMerge #10095
bors[bot] [Tue, 31 Aug 2021 12:47:33 +0000 (12:47 +0000)]
Merge #10095

10095: internal: Augment panic context when resolving path r=jonas-schievink a=jonas-schievink

Should help with debugging https://github.com/rust-analyzer/rust-analyzer/issues/10084 and similar issues.

Might have a perf impact since the string is created on every function call.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agominor: improve readability
Aleksey Kladov [Tue, 31 Aug 2021 12:44:43 +0000 (15:44 +0300)]
minor: improve readability

naming, layout & comments help!

2 years agoMerge #10098
bors[bot] [Tue, 31 Aug 2021 12:27:27 +0000 (12:27 +0000)]
Merge #10098

10098: minor: dead code r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: dead code
Aleksey Kladov [Tue, 31 Aug 2021 12:26:59 +0000 (15:26 +0300)]
minor: dead code

2 years agoMerge #10097
bors[bot] [Tue, 31 Aug 2021 12:17:50 +0000 (12:17 +0000)]
Merge #10097

10097: fix: Allow inherent impls for arrays r=jonas-schievink a=jonas-schievink

Part of https://github.com/rust-analyzer/rust-analyzer/issues/9992 (method resolution of these methods still does not work)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoAllow inherent impl for arrays
Jonas Schievink [Tue, 31 Aug 2021 12:15:39 +0000 (14:15 +0200)]
Allow inherent impl for arrays

2 years agointernal: simplify
Aleksey Kladov [Tue, 31 Aug 2021 11:54:22 +0000 (14:54 +0300)]
internal: simplify

2 years agoAugment panic context when resolving path
Jonas Schievink [Tue, 31 Aug 2021 11:42:46 +0000 (13:42 +0200)]
Augment panic context when resolving path

2 years agoMerge #10094
bors[bot] [Tue, 31 Aug 2021 11:39:34 +0000 (11:39 +0000)]
Merge #10094

10094: internal: split database loading time in anaysis-stats into components r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: split database loading time in anaysis-stats into components
Aleksey Kladov [Tue, 31 Aug 2021 11:38:52 +0000 (14:38 +0300)]
internal: split database loading time in anaysis-stats into components

2 years agoMerge #10091
bors[bot] [Tue, 31 Aug 2021 11:24:30 +0000 (11:24 +0000)]
Merge #10091

10091: fix: fix "disjunction in conjunction" panic r=matklad a=jonas-schievink

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

The DNF construction code created expressions that were combined in a way that made us "forget" to make their contents valid DNF again. This PR fixes that by flattening nested `any(any())` and `all(all())` predicates. There was also a typo that led to a redundant call to `make_nnf` instead of the correct recursive call to `make_dnf` (but this didn't seem to break/fix anything).

This also adds some light property testing, though I'm not really sure this is the best way to do it.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoSimplify `int_in_range`
Jonas Schievink [Tue, 31 Aug 2021 11:11:17 +0000 (13:11 +0200)]
Simplify `int_in_range`

2 years agoDepend on both crates individually
Jonas Schievink [Tue, 31 Aug 2021 11:10:16 +0000 (13:10 +0200)]
Depend on both crates individually

2 years agoMerge #10092
bors[bot] [Tue, 31 Aug 2021 09:11:53 +0000 (09:11 +0000)]
Merge #10092

10092: feat: Improve `extract_struct_from_enum_variant` output r=matklad a=DropDemBits

Improves the struct generated by `extract_struct_from_enum_variant`.

Summary of changes:

- Indent the generated struct and enum to the same indent level
- Preserve comments & attributes from the enum variant (something I missed when doing the same thing for the variant fields)
- Use enum's visibility for fields without any visibility, instead of filling it in with `pub`

Co-authored-by: DropDemBits <r3usrlnd@gmail.com>
2 years agofeat: Use enum's visibility for extracted struct fields
DropDemBits [Tue, 31 Aug 2021 01:18:28 +0000 (21:18 -0400)]
feat: Use enum's visibility for extracted struct fields

2 years agofix: Keep comments & attrs from enum variant
DropDemBits [Tue, 31 Aug 2021 00:47:42 +0000 (20:47 -0400)]
fix: Keep comments & attrs from enum variant

2 years agofeat: Properly indent extracted struct and enum
DropDemBits [Mon, 30 Aug 2021 23:09:29 +0000 (19:09 -0400)]
feat: Properly indent extracted struct and enum

2 years agoFix DNF construction, add proptest
Jonas Schievink [Mon, 30 Aug 2021 20:26:35 +0000 (22:26 +0200)]
Fix DNF construction, add proptest

2 years agoMerge #10089
bors[bot] [Mon, 30 Aug 2021 19:35:00 +0000 (19:35 +0000)]
Merge #10089

10089: Fix minor mispelling r=bjorn3 a=NerdyPepper

`find_map` misspelt as `wind_map` in test identifier.

Co-authored-by: Akshay <nerdy@peppe.rs>
2 years agoMerge #10076
bors[bot] [Mon, 30 Aug 2021 18:55:18 +0000 (18:55 +0000)]
Merge #10076

10076: Use struct init shorthand when applicable in fill struct fields assist r=matklad a=nathanwhit

This PR tweaks the fill struct fields assist to use the struct init shorthand when a local variable with a matching name and type is in scope.

For example:
```rust
struct Foo {
    a: usize,
    b: i32,
    c: char,
}

fn main() {
    let a = 1;
    let b = 2;
    let c = 3;
    let foo = Foo { <|> };
}
```
Before we would insert
```rust
Foo {
    a: (),
    b: (),
    c: (),
}
```
now we would insert
```rust
Foo {
    a,
    b,
    c: ()
}
```

Co-authored-by: nathan.whitaker <nathan.whitaker01@gmail.com>
2 years agoAdd coverage mark for struct init shorthand test
nathan.whitaker [Mon, 30 Aug 2021 18:37:03 +0000 (14:37 -0400)]
Add coverage mark for struct init shorthand test

2 years agofix minor mispelling
Akshay [Mon, 30 Aug 2021 17:21:14 +0000 (22:51 +0530)]
fix minor mispelling

find_map misspelt as wind_map

2 years agoMerge #10088
bors[bot] [Mon, 30 Aug 2021 16:49:13 +0000 (16:49 +0000)]
Merge #10088

10088: feat: improve CPU usage r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofeat: improve CPU usage
Aleksey Kladov [Mon, 30 Aug 2021 16:39:19 +0000 (19:39 +0300)]
feat: improve CPU usage

closes #9922

Turned out to be trivial after preliminary refactor.

The intended behavior is that we schedule cache priming once ws become
quiescent (that is, we fully load cargo project), and we continue to
rschedule it until it completes (priming might get cancelled by user
typing into a file).

2 years agointernal: make scheduling control flow more obvious
Aleksey Kladov [Mon, 30 Aug 2021 16:35:49 +0000 (19:35 +0300)]
internal: make scheduling control flow more obvious

There should be only one place where we need to check if we want to
start background activities.

2 years agointernal: improve consistency
Aleksey Kladov [Mon, 30 Aug 2021 16:24:31 +0000 (19:24 +0300)]
internal: improve consistency

Let's have only one place where we start delayed ops

2 years agointernal: more obviously correct code for cache priming progerss
Aleksey Kladov [Mon, 30 Aug 2021 16:18:48 +0000 (19:18 +0300)]
internal: more obviously correct code for cache priming progerss

It doesn't make sense for the prime_caches itself send begin/end events
-- the caller knows perfectly fine when they happen!

2 years agoMerge #10085
bors[bot] [Mon, 30 Aug 2021 12:57:39 +0000 (12:57 +0000)]
Merge #10085

10085: fix: avoid panic when parsing extern block r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: improve style
Aleksey Kladov [Mon, 30 Aug 2021 12:55:40 +0000 (15:55 +0300)]
internal: improve style

Group related stuff together, use only on path for parsing extern blocks
(they actually have modifiers).

Perhaps we should get rid of items_without_modifiers altogether? Better
to handle these kinds on diagnostics in validation layer...

2 years agofix: avoid panic when parsing extern block
Aleksey Kladov [Mon, 30 Aug 2021 12:40:47 +0000 (15:40 +0300)]
fix: avoid panic when parsing extern block

closes #10083

2 years agoMerge #10081
bors[bot] [Mon, 30 Aug 2021 09:50:16 +0000 (09:50 +0000)]
Merge #10081

10081: Fix error message r=lnicola a=digama0

I'm not entirely sure if the message is still correct, it seems to have survived a number of refactors, but it is mangled english anyway.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>
2 years agofail -> failed
Mario Carneiro [Mon, 30 Aug 2021 09:47:10 +0000 (02:47 -0700)]
fail -> failed

2 years agoUpdate crates/hir_expand/src/db.rs
Mario Carneiro [Mon, 30 Aug 2021 09:43:13 +0000 (02:43 -0700)]
Update crates/hir_expand/src/db.rs

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2 years agoFix error message
Mario Carneiro [Mon, 30 Aug 2021 09:36:21 +0000 (02:36 -0700)]
Fix error message

I'm not entirely sure if the message is still correct, it seems to have survived a number of refactors, but it is mangled english anyway.

2 years agoMerge #10005
bors[bot] [Mon, 30 Aug 2021 08:42:13 +0000 (08:42 +0000)]
Merge #10005

10005: Extend `CargoConfig.unset_test_crates`  r=matklad a=regexident

This is to allow for efficiently disabling `#[cfg(test)]` on all crates (by passing `unset_test_crates: UnsetTestCrates::All`) without having to first load the crate graph, when using rust-analyzer as a library.

(FYI: The change doesn't seem to be covered by any existing tests.)

Co-authored-by: Vincent Esche <regexident@gmail.com>
2 years agoMerge #10015
bors[bot] [Mon, 30 Aug 2021 08:34:49 +0000 (08:34 +0000)]
Merge #10015

10015: internal: more declarative re-indentation API r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoMerge #10080
bors[bot] [Mon, 30 Aug 2021 07:58:59 +0000 (07:58 +0000)]
Merge #10080

10080: internal: don't shut up the compiler when it says the code's buggy r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: don't shut up the compiler when it says the code's buggy
Aleksey Kladov [Mon, 30 Aug 2021 07:53:59 +0000 (10:53 +0300)]
internal: don't shut up the compiler when it says the code's buggy

Wrapping state-modifying functions into a `catch_unwind` is wrong -- to
do retry after failure, you need to have transactional semantics!

2 years agoMerge #10079
bors[bot] [Mon, 30 Aug 2021 07:39:34 +0000 (07:39 +0000)]
Merge #10079

10079: internal: make upstream bug less annoying r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: make upstream bug less annoying
Aleksey Kladov [Mon, 30 Aug 2021 07:25:44 +0000 (10:25 +0300)]
internal: make upstream bug less annoying

2 years agoMerge #9906
bors[bot] [Mon, 30 Aug 2021 07:30:01 +0000 (07:30 +0000)]
Merge #9906

9906: switch `log` crate to `tracing` r=lnicola a=dzvon

Fixes #9274

1. Replace `log` crate with `tracing` of every crate that depend on `log`.
2. Change all `log` record macro with `tracing`.
3. Add `LoggerFormatter` make output format be the same as original.

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2 years agoswitch `log` crate to `tracing`
Dezhi Wu [Sun, 15 Aug 2021 12:46:13 +0000 (20:46 +0800)]
switch `log` crate to `tracing`

2 years agoMerge #10078
bors[bot] [Mon, 30 Aug 2021 06:54:36 +0000 (06:54 +0000)]
Merge #10078

10078: internal: Use Ubuntu 18.04 on CI r=lnicola a=lnicola

Ubuntu 16.04 is EOL since April, let's upgrade to 18.04.

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoUse Ubuntu 18.04 on CI
Laurențiu Nicola [Mon, 30 Aug 2021 06:50:41 +0000 (09:50 +0300)]
Use Ubuntu 18.04 on CI

2 years agoUpdate existing fill struct fields test
nathan.whitaker [Sun, 29 Aug 2021 17:14:15 +0000 (13:14 -0400)]
Update existing fill struct fields test

2 years agoAdd tests for fill struct fields shorthand
nathan.whitaker [Sun, 29 Aug 2021 17:14:03 +0000 (13:14 -0400)]
Add tests for fill struct fields shorthand

2 years agoUse struct init shorthand in fill struct fields assist
nathan.whitaker [Sun, 29 Aug 2021 17:12:59 +0000 (13:12 -0400)]
Use struct init shorthand in fill struct fields assist

2 years agoMerge #10074
bors[bot] [Sun, 29 Aug 2021 15:56:06 +0000 (15:56 +0000)]
Merge #10074

10074: internal: improve compile times a bit r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: don't expose impl details out of hir
Aleksey Kladov [Sun, 29 Aug 2021 15:55:25 +0000 (18:55 +0300)]
internal: don't expose impl details out of hir

2 years agointernal: improve compile times a bit
Aleksey Kladov [Sun, 29 Aug 2021 15:49:16 +0000 (18:49 +0300)]
internal: improve compile times a bit

before after for cargo llvm-lines -q --lib --release -p ide_ssr | head -n 24

  Lines          Copies        Function name
  -----          ------        -------------
  297146 (100%)  12748 (100%)  (TOTAL)
    5970 (2.0%)     47 (0.4%)  core::iter::traits::iterator::Iterator::try_fold
    4750 (1.6%)     27 (0.2%)  hashbrown::raw::RawTable<T,A>::resize
    4080 (1.4%)     30 (0.2%)  alloc::raw_vec::RawVec<T,A>::grow_amortized
    3933 (1.3%)     69 (0.5%)  alloc::raw_vec::RawVec<T,A>::current_memory
    3668 (1.2%)     89 (0.7%)  <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
    3500 (1.2%)     50 (0.4%)  hashbrown::raw::RawTable<T,A>::drop_elements
    3436 (1.2%)     33 (0.3%)  hashbrown::raw::RawTable<T,A>::find
    3415 (1.1%)     17 (0.1%)  hashbrown::raw::RawTable<T,A>::rehash_in_place
    3400 (1.1%)     50 (0.4%)  <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
    2840 (1.0%)     20 (0.2%)  alloc::raw_vec::RawVec<T,A>::allocate_in
    2700 (0.9%)     30 (0.2%)  core::alloc::layout::Layout::array
    2666 (0.9%)     86 (0.7%)  core::ptr::metadata::from_raw_parts_mut
    2495 (0.8%)     50 (0.4%)  core::option::Option<T>::map
    2354 (0.8%)     38 (0.3%)  alloc::alloc::box_free
    2302 (0.8%)      7 (0.1%)  ide_ssr::parsing::RuleBuilder::try_add
    2146 (0.7%)     45 (0.4%)  core::mem::replace
    2070 (0.7%)     69 (0.5%)  <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
    1979 (0.7%)     16 (0.1%)  hashbrown::map::HashMap<K,V,S,A>::insert
    1926 (0.6%)     18 (0.1%)  <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
    1922 (0.6%)     62 (0.5%)  core::fmt::ArgumentV1::new
    1885 (0.6%)     13 (0.1%)  alloc::raw_vec::RawVec<T,A>::shrink

  Lines          Copies        Function name
  -----          ------        -------------
  261717 (100%)  11666 (100%)  (TOTAL)
    5239 (2.0%)     42 (0.4%)  core::iter::traits::iterator::Iterator::try_fold
    4750 (1.8%)     27 (0.2%)  hashbrown::raw::RawTable<T,A>::resize
    3933 (1.5%)     69 (0.6%)  alloc::raw_vec::RawVec<T,A>::current_memory
    3536 (1.4%)     26 (0.2%)  alloc::raw_vec::RawVec<T,A>::grow_amortized
    3500 (1.3%)     50 (0.4%)  hashbrown::raw::RawTable<T,A>::drop_elements
    3400 (1.3%)     50 (0.4%)  <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
    3124 (1.2%)     30 (0.3%)  hashbrown::raw::RawTable<T,A>::find
    2812 (1.1%)     14 (0.1%)  hashbrown::raw::RawTable<T,A>::rehash_in_place
    2604 (1.0%)     84 (0.7%)  core::ptr::metadata::from_raw_parts_mut
    2340 (0.9%)     26 (0.2%)  core::alloc::layout::Layout::array
    2302 (0.9%)      7 (0.1%)  ide_ssr::parsing::RuleBuilder::try_add
    2272 (0.9%)     16 (0.1%)  alloc::raw_vec::RawVec<T,A>::allocate_in
    2201 (0.8%)     35 (0.3%)  alloc::alloc::box_free
    2104 (0.8%)     44 (0.4%)  core::mem::replace
    2079 (0.8%)     42 (0.4%)  <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
    2070 (0.8%)     69 (0.6%)  <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
    1926 (0.7%)     18 (0.2%)  <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
    1885 (0.7%)     13 (0.1%)  alloc::raw_vec::RawVec<T,A>::shrink
    1833 (0.7%)     13 (0.1%)  hashbrown::raw::RawTable<T,A>::shrink_to
    1771 (0.7%)     91 (0.8%)  core::ptr::read
    1701 (0.6%)     35 (0.3%)  core::option::Option<T>::map

2 years agoMerge #10071
bors[bot] [Sun, 29 Aug 2021 09:54:33 +0000 (09:54 +0000)]
Merge #10071

10071: internal: slightly improve compile times r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: slightly improve compile times
Aleksey Kladov [Sun, 29 Aug 2021 09:31:42 +0000 (12:31 +0300)]
internal: slightly improve compile times

As per style guide, avoid monomorphisations

2 years agominor: remove debug print
Aleksey Kladov [Sun, 29 Aug 2021 09:32:35 +0000 (12:32 +0300)]
minor: remove debug print

2 years agoMerge #10067
bors[bot] [Sat, 28 Aug 2021 23:38:34 +0000 (23:38 +0000)]
Merge #10067

10067: Downmap tokens to all token descendants instead of just the first r=Veykril a=Veykril

With this we can now resolve usages of identifiers inside (proc-)macros even if they are used for different purposes multiple times inside the expansion.
Example here being with the cursor being on the `no_send_sync_value` function causing us to still highlight the identifier in the attribute invocation correctly as we now resolve its usages in there. Prior we only saw the first usage of the identifier which is for a definition only, as such we bailed and didn't highlight it.
![image](https://user-images.githubusercontent.com/3757771/131233056-7e645b1d-b82f-468c-bf19-d3335a2cf7c2.png)

Note that this has to be explicitly switched over for most IDE features now as pretty much everything expects a single node/token as a result from descending.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Sat, 28 Aug 2021 23:38:10 +0000 (01:38 +0200)]
Simplify

2 years agoOnly report unique text ranges in highlight_related
Lukas Wirth [Sat, 28 Aug 2021 22:45:55 +0000 (00:45 +0200)]
Only report unique text ranges in highlight_related