]> git.lizzy.rs Git - rust.git/log
rust.git
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

3 years agoMerge #9080
bors[bot] [Mon, 21 Jun 2021 17:05:21 +0000 (17:05 +0000)]
Merge #9080

9080: Improve completion of cfg attributes r=JamieCunliffe a=JamieCunliffe

This will close #5398 and it also adds some completion for cfg options.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@outlook.com>
3 years agoMove features into potential_cfg_options
Jamie Cunliffe [Mon, 31 May 2021 19:45:01 +0000 (20:45 +0100)]
Move features into potential_cfg_options

3 years agoImprove completion of cfg attributes
Jamie Cunliffe [Sun, 30 May 2021 13:52:19 +0000 (14:52 +0100)]
Improve completion of cfg attributes

The completion of cfg will look at the enabled cfg keys when
performing completion.

It will also look crate features when completing a feature cfg
option. A fixed list of known values for some cfg options are
provided.

For unknown keys it will look at the enabled values for that cfg key,
which means that completion will only show enabled options for those.

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

9359: internal: Update vscode-languageclient r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoUpdate vscode-languageclient
kjeremy [Mon, 21 Jun 2021 15:30:08 +0000 (11:30 -0400)]
Update vscode-languageclient

3 years agoMerge #9165
bors[bot] [Mon, 21 Jun 2021 15:11:21 +0000 (15:11 +0000)]
Merge #9165

9165: Apply some clippy suggestions r=matklad a=clemenswasser

Co-authored-by: Clemens Wasser <clemens.wasser@gmail.com>
3 years agoApply some clippy suggestions
Clemens Wasser [Mon, 7 Jun 2021 11:59:01 +0000 (13:59 +0200)]
Apply some clippy suggestions

3 years agoMerge #9264
bors[bot] [Mon, 21 Jun 2021 14:15:49 +0000 (14:15 +0000)]
Merge #9264

9264: feat: Make documentation on hover configurable r=Veykril a=Veykril

This also implements deprecation support for config options as this renames `hoverActions_linksInHover` to `hover_linksInHover`.

Fixes #9232

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoRemove deprecation support in config
Lukas Wirth [Mon, 21 Jun 2021 14:01:03 +0000 (16:01 +0200)]
Remove deprecation support in config

3 years agoMerge #9314
bors[bot] [Mon, 21 Jun 2021 13:59:29 +0000 (13:59 +0000)]
Merge #9314

9314: Fix extract_function with await r=sasurau4 a=sasurau4

Fix #9287

Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
3 years agoFix var name
Daiki Ihara [Mon, 21 Jun 2021 13:47:39 +0000 (22:47 +0900)]
Fix var name

3 years agoMerge #9227
bors[bot] [Mon, 21 Jun 2021 13:41:27 +0000 (13:41 +0000)]
Merge #9227

9227: Add a config setting to disable the 'test' cfg in specified crates r=matklad a=lf-

If you are opening libcore from rust-lang/rust as opposed to e.g.
goto definition from some other crate which would use the sysroot
instance of libcore, a `#![cfg(not(test))]` would previously have made
all the code excluded from the module tree, breaking the editor
experience.

Core does not need to ever be edited with `#[cfg(test)]` enabled,
as the tests are in another crate.

This PR puts in a slight hack that checks for the crate name "core" and
turns off `#[cfg(test)]` for that crate.

Fixes #9203
Fixes #9226

Co-authored-by: Jade <software@lfcode.ca>
3 years agoMerge #9357
bors[bot] [Mon, 21 Jun 2021 13:27:57 +0000 (13:27 +0000)]
Merge #9357

9357: fix: Update sysroot crates r=jonas-schievink a=jonas-schievink

Removes `rtstartup`, since that's not a Cargo crate (its files are compiled into object files and linked alongside the stdlib).

Adds  `std_detect`.

Part of https://github.com/rust-analyzer/rust-analyzer/issues/9352 (doesn't fix it since std_detect is full of `cfg_if!`)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoUpdate sysroot crates
Jonas Schievink [Mon, 21 Jun 2021 13:26:26 +0000 (15:26 +0200)]
Update sysroot crates

3 years agoMerge #9356
bors[bot] [Mon, 21 Jun 2021 13:15:12 +0000 (13:15 +0000)]
Merge #9356

9356: internal: Move out and regroup more completion tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoVarious keyword completion fixes
Lukas Wirth [Mon, 21 Jun 2021 13:14:28 +0000 (15:14 +0200)]
Various keyword completion fixes

3 years agoMove out completion type position tests
Lukas Wirth [Mon, 21 Jun 2021 12:59:49 +0000 (14:59 +0200)]
Move out completion type position tests

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

9355: Don't insert `}` when typing `{` in string r=jonas-schievink a=jonas-schievink

Checks that the token at the cursor is `L_CURLY`.

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoDon't insert `}` when typing `{` in string
Jonas Schievink [Mon, 21 Jun 2021 12:54:49 +0000 (14:54 +0200)]
Don't insert `}` when typing `{` in string

3 years agoMerge #9347
bors[bot] [Mon, 21 Jun 2021 12:52:08 +0000 (12:52 +0000)]
Merge #9347

9347: add note about passing cfg(debug_assertions) r=matklad a=rezural

add note about passing cfg(debug_assertions) to rustc on build. The server will not spin on start  without this arcane hack

Co-authored-by: rezural <69941255+rezural@users.noreply.github.com>
3 years agoMove out completion pattern tests
Lukas Wirth [Mon, 21 Jun 2021 11:48:25 +0000 (13:48 +0200)]
Move out completion pattern tests

3 years agoFix pointed out
Daiki Ihara [Mon, 21 Jun 2021 09:42:25 +0000 (18:42 +0900)]
Fix pointed out

3 years agoFix extract_function with await
Daiki Ihara [Thu, 17 Jun 2021 14:54:49 +0000 (23:54 +0900)]
Fix extract_function with await

3 years agooutput to log file if RA_LOG_FILE is defined in environment
rezural [Sun, 20 Jun 2021 23:33:57 +0000 (09:33 +1000)]
output to log file if RA_LOG_FILE is defined in environment

3 years agoMerge #9346
bors[bot] [Sun, 20 Jun 2021 17:38:27 +0000 (17:38 +0000)]
Merge #9346

9346: Refactor / clean up hir_ty tests r=flodiebold a=flodiebold

Notable changes:
 - unify `check_types` and `check_mismatches` into `check`, which supports both kinds of annotations (`check_types` still exists because I didn't want to change all the annotations, but uses the same implementation)
 - because of that, `check_types` now fails on any type mismatches; also annotations always have to hit the exact range
 - there's also `check_no_mismatches` for when we explicitly just want to check that there are no type mismatches without giving any annotations (`check` will fail without annotations)
 - test annotations can now be overlapping (they point to the nearest line that has actual code in that range):
```
// ^^^^ annotation
//    ^^^^^^^^^ another annotation
```

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
3 years agoFix `benchmark_include_macro`
Florian Diebold [Sun, 20 Jun 2021 17:37:45 +0000 (19:37 +0200)]
Fix `benchmark_include_macro`