]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge #9436
bors[bot] [Wed, 30 Jun 2021 17:37:28 +0000 (17:37 +0000)]
Merge #9436

9436: minor: Add test for macro expanded test module in runnables r=Veykril a=Veykril

Expected this to fail as thats behaving incorrectly on current nightly but I think I fixed this accidentally with https://github.com/rust-analyzer/rust-analyzer/pull/9435
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAdd test for macro expanded test module in runnables
Lukas Wirth [Wed, 30 Jun 2021 17:35:58 +0000 (19:35 +0200)]
Add test for macro expanded test module in runnables

3 years agoMerge #9435
bors[bot] [Wed, 30 Jun 2021 17:11:34 +0000 (17:11 +0000)]
Merge #9435

9435: fix: Don't add test runnables for outline modules in the wrong file r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoDon't add test runnables for outline modules in the wrong file
Lukas Wirth [Wed, 30 Jun 2021 17:08:13 +0000 (19:08 +0200)]
Don't add test runnables for outline modules in the wrong file

3 years agoMerge #9434
bors[bot] [Wed, 30 Jun 2021 14:04:35 +0000 (14:04 +0000)]
Merge #9434

9434: Cargo update and pull in the new rowan r=kjeremy a=kjeremy

This brings in the new hashbrown for better compile times.

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoCargo update and pull in the new rowan
kjeremy [Wed, 30 Jun 2021 14:03:31 +0000 (10:03 -0400)]
Cargo update and pull in the new rowan

This brings in the new hashbrown for better compile times.

3 years agoMerge #9269
bors[bot] [Tue, 29 Jun 2021 19:53:19 +0000 (19:53 +0000)]
Merge #9269

9269: Recreate status page r=lnicola a=Milo123459

I'm working on redesigning the status page.

Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
3 years agofix
Milo [Tue, 29 Jun 2021 19:34:52 +0000 (20:34 +0100)]
fix

3 years agoUpdate crates/ide/src/status.rs
Milo [Tue, 29 Jun 2021 19:32:33 +0000 (20:32 +0100)]
Update crates/ide/src/status.rs

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
3 years agoMerge #9426
bors[bot] [Tue, 29 Jun 2021 17:39:00 +0000 (17:39 +0000)]
Merge #9426

9426: fix: Watch for Cargo.toml and .lock changes r=matklad a=lnicola

Maybe closes #5333

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoWatch for Cargo.toml and .lock changes
Laurențiu Nicola [Tue, 29 Jun 2021 11:38:50 +0000 (14:38 +0300)]
Watch for Cargo.toml and .lock changes

3 years agoMerge #9423
bors[bot] [Mon, 28 Jun 2021 19:57:23 +0000 (19:57 +0000)]
Merge #9423

9423: fix: Resolve attribute paths in attribute highlighting r=Veykril a=Veykril

Attributes have a new highlighting format now, whereas the `#[` `]` tokens are now tagged with `attribute.attribute` like before, but all other idents inside token trees are now `generic.attribute`. If a path in an attribute can't be resolved it will instead get the `builtinAttribute.attribute` tags now as highlighting doesn't know about builtins like `allow` yet, so we don't want to emit unresolved references.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoResolve attribute paths in attribute highlighting
Lukas Wirth [Mon, 28 Jun 2021 19:34:30 +0000 (21:34 +0200)]
Resolve attribute paths in attribute highlighting

3 years agoMerge #9422
bors[bot] [Mon, 28 Jun 2021 18:16:00 +0000 (18:16 +0000)]
Merge #9422

9422: fix: Handle `::{self}` imports r=jonas-schievink a=jonas-schievink

These import the preceding segment, but only in type namespace. Previously we've imported the name in all namespaces.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoHandle `::{self}` imports
Jonas Schievink [Mon, 28 Jun 2021 18:11:58 +0000 (20:11 +0200)]
Handle `::{self}` imports

3 years agoMerge #9421
bors[bot] [Mon, 28 Jun 2021 17:23:24 +0000 (17:23 +0000)]
Merge #9421

9421: minor: Record attributes in attr_query for proc-macros r=jonas-schievink a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoRecord attributes in attr_query for proc-macros
Lukas Wirth [Mon, 28 Jun 2021 17:16:38 +0000 (19:16 +0200)]
Record attributes in attr_query for proc-macros

3 years agoMerge #9420
bors[bot] [Mon, 28 Jun 2021 17:08:08 +0000 (17:08 +0000)]
Merge #9420

9420: fix: Make hover on attribute paths work again r=Veykril a=Veykril

Unfortunately not (yet) unit-testable I believe

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFix `NameRef::classify` path resolution inside attributes
Lukas Wirth [Mon, 28 Jun 2021 16:33:42 +0000 (18:33 +0200)]
Fix `NameRef::classify` path resolution inside attributes

3 years agoremove unneeded ifs
Milo [Mon, 28 Jun 2021 16:52:57 +0000 (17:52 +0100)]
remove unneeded ifs

3 years agocheck if counts should be a thing
Milo [Mon, 28 Jun 2021 16:50:24 +0000 (17:50 +0100)]
check if counts should be a thing

3 years agotrailing line
Milo [Mon, 28 Jun 2021 16:49:19 +0000 (17:49 +0100)]
trailing line

3 years agoMerge #9418
bors[bot] [Mon, 28 Jun 2021 14:42:22 +0000 (14:42 +0000)]
Merge #9418

9418: internal: Include `self` in usage search for modules in their definition source r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoInclude `self` in usage search for modules in their definition source
Lukas Wirth [Mon, 28 Jun 2021 14:41:35 +0000 (16:41 +0200)]
Include `self` in usage search for modules in their definition source

3 years agofix all reviews
Milo [Mon, 28 Jun 2021 06:31:54 +0000 (07:31 +0100)]
fix all reviews

3 years agoMerge #9415
bors[bot] [Mon, 28 Jun 2021 06:29:10 +0000 (06:29 +0000)]
Merge #9415

9415: minor: Avoid redundant clone r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoAvoid redundant clone
Laurențiu Nicola [Mon, 28 Jun 2021 06:28:31 +0000 (09:28 +0300)]
Avoid redundant clone

3 years agoMerge #9413
bors[bot] [Sat, 26 Jun 2021 23:16:38 +0000 (23:16 +0000)]
Merge #9413

9413: internal: Deduplicate ast expression walking logic r=Veykril a=Veykril

Deduplicates the duplication introduced in #9375 and #9396 while also fixing a few bugs in both the assist and related highlighting.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoDeduplicate ast expression walking logic
Lukas Wirth [Sat, 26 Jun 2021 23:11:57 +0000 (01:11 +0200)]
Deduplicate ast expression walking logic

3 years agoMerge #9408
bors[bot] [Fri, 25 Jun 2021 20:53:32 +0000 (20:53 +0000)]
Merge #9408

9408: intenral: small improvements to compile time r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointenral: small improvements to compile time
Aleksey Kladov [Fri, 25 Jun 2021 20:51:54 +0000 (23:51 +0300)]
intenral: small improvements to compile time

AsRef-polymorphism has compile-time cost.

3 years agoMerge #9402
bors[bot] [Fri, 25 Jun 2021 20:38:18 +0000 (20:38 +0000)]
Merge #9402

9402: internal: add cloning macro fixture r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: add cloning macro fixture
Aleksey Kladov [Fri, 25 Jun 2021 07:32:13 +0000 (10:32 +0300)]
internal: add cloning macro fixture

Macro that deep clone the tokens but otherwise preserves source
locations and hygiene info is an interesting case for IDE support. Lets
have this, although we don't actively use it at the moment.

3 years agoMerge #9400
bors[bot] [Fri, 25 Jun 2021 01:48:50 +0000 (01:48 +0000)]
Merge #9400

9400: fix: Fix renaming associated trait items with colliding names r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFix renaming associated trait items with colliding names
Lukas Wirth [Fri, 25 Jun 2021 01:45:41 +0000 (03:45 +0200)]
Fix renaming associated trait items with colliding names

3 years agoMerge #9398
bors[bot] [Thu, 24 Jun 2021 20:21:20 +0000 (20:21 +0000)]
Merge #9398

9398: minor: Complete `macro_use` attribute on modules r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoComplete `macro_use` attribute on modules
Lukas Wirth [Thu, 24 Jun 2021 19:37:07 +0000 (21:37 +0200)]
Complete `macro_use` attribute on modules

3 years agoMerge #9397
bors[bot] [Thu, 24 Jun 2021 19:15:59 +0000 (19:15 +0000)]
Merge #9397

9397: fix: Fix break point highlighting not considering outer labels r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFix break point highlighting not considering outer labels
Lukas Wirth [Thu, 24 Jun 2021 19:14:43 +0000 (21:14 +0200)]
Fix break point highlighting not considering outer labels

3 years agoMerge #9396
bors[bot] [Thu, 24 Jun 2021 19:05:41 +0000 (19:05 +0000)]
Merge #9396

9396: feat: Highlight loop break points r=Veykril a=Veykril

![Code_HmWQMlioKr](https://user-images.githubusercontent.com/3757771/123318732-d47be280-d52f-11eb-8a9a-cb3f591d4195.png)
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoHighlight label value block tails
Lukas Wirth [Thu, 24 Jun 2021 19:01:37 +0000 (21:01 +0200)]
Highlight label value block tails

3 years agoHighlight loop break points
Lukas Wirth [Thu, 24 Jun 2021 18:57:02 +0000 (20:57 +0200)]
Highlight loop break points

3 years agoMerge #9375
bors[bot] [Thu, 24 Jun 2021 15:23:25 +0000 (15:23 +0000)]
Merge #9375

9375: feat: Highlight exit and yield points r=Veykril a=Veykril

![Code_YBHOCF3DbU](https://user-images.githubusercontent.com/3757771/123128986-e1270a80-d44b-11eb-9854-065459a2dd50.png)
![Code_YyMhqES0LX](https://user-images.githubusercontent.com/3757771/123128988-e1bfa100-d44b-11eb-9c81-6a6031aad740.png)

Fixes #4691
Fixes #9365

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoRefine tail exit point highlighting to highlight inner tails
Lukas Wirth [Thu, 24 Jun 2021 15:19:27 +0000 (17:19 +0200)]
Refine tail exit point highlighting to highlight inner tails

3 years agoSimplify
Lukas Wirth [Thu, 24 Jun 2021 14:50:56 +0000 (16:50 +0200)]
Simplify

3 years agoSimplify
Lukas Wirth [Wed, 23 Jun 2021 23:32:56 +0000 (01:32 +0200)]
Simplify

3 years agoMerge #9380
bors[bot] [Wed, 23 Jun 2021 22:33:05 +0000 (22:33 +0000)]
Merge #9380

9380: feat: Implement goto_declaration support r=matklad a=Veykril

This is just a simple implementation that falls back to `goto_definition` for everything but modules where it goes to the actual module declaration if possible.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agomove goto_declaration fall back into handlers
Lukas Wirth [Wed, 23 Jun 2021 22:22:02 +0000 (00:22 +0200)]
move goto_declaration fall back into handlers

3 years agoMerge #9353
bors[bot] [Wed, 23 Jun 2021 21:33:30 +0000 (21:33 +0000)]
Merge #9353

9353: Include extra targets when the pkg_root is not the same as the target root. r=matklad a=rezural

Fixes #7715

For example, if a sub-crate includes sets the path='../somewhere-else/lib.rs', the files will not be in pkg_root , but in the target root's parent.

It may actually be in root.parent().parent(), I'm not sure about that.

At the moment it is just a fix, are there any relevant tests that this could go in? I've got about 1 brain cell left... but im happy to add tests where appropriate.

Co-authored-by: rezural <rezural@protonmail.com>
3 years agoMerge #9390
bors[bot] [Wed, 23 Jun 2021 17:14:37 +0000 (17:14 +0000)]
Merge #9390

9390: fix: Improve type bound completions r=Veykril a=Veykril

Closes #9389
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFix incorrect base fixture in ide_completion tests
Lukas Wirth [Wed, 23 Jun 2021 17:13:24 +0000 (19:13 +0200)]
Fix incorrect base fixture in ide_completion tests

3 years agoRestrict type bound completions to traits, modules and macros
Lukas Wirth [Wed, 23 Jun 2021 17:10:03 +0000 (19:10 +0200)]
Restrict type bound completions to traits, modules and macros

3 years agoAdd predicate tests for ide_completions
Lukas Wirth [Wed, 23 Jun 2021 16:58:19 +0000 (18:58 +0200)]
Add predicate tests for ide_completions

3 years agoLift out base item fixture for ide_completion tests
Lukas Wirth [Wed, 23 Jun 2021 16:37:47 +0000 (18:37 +0200)]
Lift out base item fixture for ide_completion tests

3 years agoImprove feature docs for highlight_related
Lukas Wirth [Wed, 23 Jun 2021 16:11:48 +0000 (18:11 +0200)]
Improve feature docs for highlight_related

3 years agoMark (method-)calls with never type as exit points
Lukas Wirth [Wed, 23 Jun 2021 15:21:47 +0000 (17:21 +0200)]
Mark (method-)calls with never type as exit points

3 years agoSimplify
Lukas Wirth [Wed, 23 Jun 2021 15:05:00 +0000 (17:05 +0200)]
Simplify

3 years agoStrip leading whitespace from test ouput in `references`
Lukas Wirth [Wed, 23 Jun 2021 14:49:36 +0000 (16:49 +0200)]
Strip leading whitespace from test ouput in `references`

3 years agoImplement exit point highlighting
Lukas Wirth [Wed, 23 Jun 2021 14:43:53 +0000 (16:43 +0200)]
Implement exit point highlighting

3 years agoImplement yield point highlighting
Lukas Wirth [Wed, 23 Jun 2021 14:16:32 +0000 (16:16 +0200)]
Implement yield point highlighting

3 years agoRename 'document_highlight' to 'highlight_related'
Lukas Wirth [Wed, 23 Jun 2021 12:56:40 +0000 (14:56 +0200)]
Rename 'document_highlight' to 'highlight_related'

3 years agoMove document highlighting computation from rust-analyzer to ide
Lukas Wirth [Tue, 22 Jun 2021 17:39:59 +0000 (19:39 +0200)]
Move document highlighting computation from rust-analyzer to ide

3 years agoMerge #9031
bors[bot] [Tue, 22 Jun 2021 23:58:59 +0000 (23:58 +0000)]
Merge #9031

9031: Add `public` semantic token modifier for public items r=Veykril a=arzg

Closes #8943.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
3 years agoAdd `public` semantic token modifier for public items
Aramis Razzaghipour [Thu, 27 May 2021 23:25:32 +0000 (09:25 +1000)]
Add `public` semantic token modifier for public items

3 years agoMerge #9383
bors[bot] [Tue, 22 Jun 2021 22:28:43 +0000 (22:28 +0000)]
Merge #9383

9383: internal: Rewrite token tree lowering to use an explicit stack r=jonas-schievink a=jonas-schievink

Part of https://github.com/rust-analyzer/rust-analyzer/issues/9358, this fixes the first cause of the stack overflow there. Unfortunately we now run into a stack overflow in the parser.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoRewrite `convert_tokens` to use an explicit stack
Jonas Schievink [Tue, 22 Jun 2021 12:23:31 +0000 (14:23 +0200)]
Rewrite `convert_tokens` to use an explicit stack

3 years agoMove subtree collection out of `TokenConvertor`
Jonas Schievink [Mon, 21 Jun 2021 20:57:54 +0000 (22:57 +0200)]
Move subtree collection out of `TokenConvertor`

3 years agoMerge #9381
bors[bot] [Tue, 22 Jun 2021 20:01:34 +0000 (20:01 +0000)]
Merge #9381

9381: Fix compilation on WASM r=matklad a=flodiebold

Fixes #9214.
Fixes #9210.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
3 years agoFix compilation on WASM
Florian Diebold [Tue, 22 Jun 2021 19:51:57 +0000 (21:51 +0200)]
Fix compilation on WASM

Fixes #9214.
Fixes #9210.

3 years agoImplement goto_declaration support
Lukas Wirth [Tue, 22 Jun 2021 18:43:48 +0000 (20:43 +0200)]
Implement goto_declaration support

3 years agoMerge #9379
bors[bot] [Tue, 22 Jun 2021 18:26:30 +0000 (18:26 +0000)]
Merge #9379

9379: internal: remove one more accidentally quadratic code-path r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: remove one more accidentally quadratic code-path
Aleksey Kladov [Tue, 22 Jun 2021 18:22:36 +0000 (21:22 +0300)]
internal: remove one more accidentally quadratic code-path

Definition::visibility was implemented in a rather roundabout way -- by
asking the parent module about the effective visibility.

This is problematic for a couple of reasons:

* first, it doesn't work for local items
* second, asking module about visibility of a child is a linear
  operation (that's a problem in itself, tracked in #9378)

Instead, lets ask the declared visibility directly, we have all the code
for it, and need only to actually us it.

3 years agoMerge #9377
bors[bot] [Tue, 22 Jun 2021 18:03:38 +0000 (18:03 +0000)]
Merge #9377

9377: internal: count ItemScopes r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: count ItemScopes
Aleksey Kladov [Tue, 22 Jun 2021 18:02:08 +0000 (21:02 +0300)]
internal: count ItemScopes

3 years agoMerge #9376
bors[bot] [Tue, 22 Jun 2021 17:57:24 +0000 (17:57 +0000)]
Merge #9376

9376: minor: clarify naming r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agominor: clarify naming
Aleksey Kladov [Tue, 22 Jun 2021 17:56:52 +0000 (20:56 +0300)]
minor: clarify naming

3 years agoMerge #9374
bors[bot] [Tue, 22 Jun 2021 17:24:57 +0000 (17:24 +0000)]
Merge #9374

9374: Update crates r=kjeremy a=kjeremy

Drops byteorder

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoUpdate crates
kjeremy [Tue, 22 Jun 2021 17:18:48 +0000 (13:18 -0400)]
Update crates

3 years agoMerge #9373
bors[bot] [Tue, 22 Jun 2021 17:17:54 +0000 (17:17 +0000)]
Merge #9373

9373: internal: Factor out `pick_best_token` ide pattern into `ide_db` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFactor out `pick_best_token` ide pattern into `ide_db`
Lukas Wirth [Tue, 22 Jun 2021 15:28:07 +0000 (17:28 +0200)]
Factor out `pick_best_token` ide pattern into `ide_db`

3 years agoMerge #9372
bors[bot] [Tue, 22 Jun 2021 13:54:20 +0000 (13:54 +0000)]
Merge #9372

9372: intenral: dont export impl details r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointenral: dont export impl details
Aleksey Kladov [Tue, 22 Jun 2021 13:47:34 +0000 (16:47 +0300)]
intenral: dont export impl details

3 years agoMerge #9370
bors[bot] [Tue, 22 Jun 2021 13:12:39 +0000 (13:12 +0000)]
Merge #9370

9370: minor: extend source_to_def docs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agominor: extend source_to_def docs
Aleksey Kladov [Tue, 22 Jun 2021 13:12:01 +0000 (16:12 +0300)]
minor: extend source_to_def docs

3 years agoMerge #9369
bors[bot] [Tue, 22 Jun 2021 12:32:02 +0000 (12:32 +0000)]
Merge #9369

9369: internal: document source_to_def and it's connection to Kotlin&Roslyn r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: document source_to_def and it's connection to Kotlin&Roslyn
Aleksey Kladov [Tue, 22 Jun 2021 12:31:04 +0000 (15:31 +0300)]
internal: document source_to_def and it's connection to Kotlin&Roslyn

3 years agoMerge #9368
bors[bot] [Tue, 22 Jun 2021 10:06:34 +0000 (10:06 +0000)]
Merge #9368

9368: fix: Prefer identifier tokens in expand_macro r=Veykril a=Veykril

Fixes #9366
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoPrefer identifier tokens in expand_macro
Lukas Wirth [Tue, 22 Jun 2021 10:03:51 +0000 (12:03 +0200)]
Prefer identifier tokens in expand_macro

3 years agoMerge #9367
bors[bot] [Tue, 22 Jun 2021 08:46:01 +0000 (08:46 +0000)]
Merge #9367

9367: Document perf characteristic of to_node r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoDocument perf characteristic of to_node
Aleksey Kladov [Tue, 22 Jun 2021 08:45:22 +0000 (11:45 +0300)]
Document perf characteristic of to_node

3 years agoadd extra include paths, if target's path is manually set in Cargo.toml to be
rezural [Mon, 21 Jun 2021 22:59:57 +0000 (08:59 +1000)]
add extra include paths, if target's path is manually set in Cargo.toml to be

3 years agoMerge #9348
bors[bot] [Mon, 21 Jun 2021 21:42:02 +0000 (21:42 +0000)]
Merge #9348

9348: output to log file if RA_LOG_FILE is defined in environment r=rezural a=rezural

This adds a check for RA_LOG_FILE, and logs to that if defined. It currently overrides flags.log_file. If this is undesirable, I will add a check.

Co-authored-by: rezural <rezural@protonmail.com>
3 years agoadd documentation of RA_LOG_FILE
rezural [Mon, 21 Jun 2021 21:28:33 +0000 (07:28 +1000)]
add documentation of RA_LOG_FILE

3 years agoMerge #9364
bors[bot] [Mon, 21 Jun 2021 20:00:56 +0000 (20:00 +0000)]
Merge #9364

9364: Split hover actions config into its own config struct r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoCollapse documentation and markdown config settings into an enum
Lukas Wirth [Mon, 21 Jun 2021 19:57:01 +0000 (21:57 +0200)]
Collapse documentation and markdown config settings into an enum

3 years agoMerge #9363
bors[bot] [Mon, 21 Jun 2021 19:48:02 +0000 (19:48 +0000)]
Merge #9363

9363: Set explicit target directory to avoid cargo deadlock r=jonas-schievink a=oxalica

Fix #9360

r? @jonas-schievink

Co-authored-by: oxalica <oxalicc@pm.me>
3 years agoSplit hover actions config into its own config struct
Lukas Wirth [Mon, 21 Jun 2021 19:41:06 +0000 (21:41 +0200)]
Split hover actions config into its own config struct

3 years agoSet explicit target directory to avoid cargo deadlock
oxalica [Mon, 21 Jun 2021 19:14:08 +0000 (03:14 +0800)]
Set explicit target directory to avoid cargo deadlock

3 years agoMerge #9362
bors[bot] [Mon, 21 Jun 2021 18:04:57 +0000 (18:04 +0000)]
Merge #9362

9362: feature: massively improve performance for large files r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agofeature: massively improve performance for large files
Aleksey Kladov [Mon, 21 Jun 2021 17:14:38 +0000 (20:14 +0300)]
feature: massively improve performance for large files

This story begins in #8384, where we added a smart test for our syntax
highting, which run the algorithm on synthetic files of varying length
in order to guesstimate if the complexity is O(N^2) or O(N)-ish.

The test turned out to be pretty effective, and flagged #9031 as a
change that makes syntax highlighting accidentally quadratic. There was
much rejoicing, for the time being.

Then, lnicola asked an ominous question[1]: "Are we sure that the time
is linear right now?"

Of course it turned out that our sophisticated non-linearity detector
*was* broken, and that our syntax highlighting *was* quadratic.

Investigating that, many brave hearts dug deeper and deeper into the
guts of rust-analyzer, only to get lost in a maze of traits delegating
to traits delegating to macros.

Eventually, matklad managed to peel off all layers of abstraction one by
one, until almost nothing was left. In fact, the issue was discovered in
the very foundation of the rust-analyzer -- in the syntax trees.

Worse, it was not a new problem, but rather a well-know, well-understood
and event (almost) well-fixed (!) performance bug.

The problem lies within `SyntaxNodePtr` type -- a light-weight "address"
of a node in a syntax tree [3]. Such pointers are used by rust-analyzer all
other the place to record relationships between IR nodes and the
original syntax.

Internally, the pointer to a syntax node is represented by node's range.
To "dereference" the pointer, you traverse the syntax tree from the
root, looking for the node with the right range. The inner loop of this
search is finding a node's child whose range contains the specified
range. This inner loop was implemented by naive linear search over all
the children. For wide trees, dereferencing a single `SyntaxNodePtr` was
linear. The problem with wide trees though is that they contain a lot of
nodes! And dereferencing pointers to all the nodes is quadratic in the
size of the file!

The solution to this problem is to speed up the children search --
rather than doing a linear lookup, we can use binary search to locate
the child with the desired interval.

Doing this optimization was one of the motivations (or rather, side
effects) of #6857. That's why `rowan` grew the useful
`child_or_token_at_range` method which does exactly this binary search.

But looks like we've never actually switch to this method? Oups.

Lesson learned: do not leave broken windows in the fundamental infra.
Otherwise, you'll have to repeatedly re-investigate the issue, by
digging from the top of the Everest down to the foundation!

[1]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/.60syntax_highlighting_not_quadratic.60.20failure/near/240811501
[2]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Syntax.20highlighting.20is.20quadratic
[3]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Syntax.20highlighting.20is.20quadratic/near/243412392