Commit graph

7718 commits

Author SHA1 Message Date
Aleksey Kladov
afab67e69c Allow negative bytes
Gotta be optimistic about those memory usage optimizations
2020-07-30 09:57:36 +02:00
Aleksey Kladov
dae99b6661 Drop resident from memory usage 2020-07-30 09:45:20 +02:00
bors[bot]
9da454bcc2
Merge #5578
5578: Rename ModuleItem -> Item r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-29 22:48:04 +00:00
Aleksey Kladov
ede5d17b04 Finish SourceFile grammar 2020-07-30 00:46:39 +02:00
Aleksey Kladov
6636f56e79 Rename ModuleItem -> Item 2020-07-30 00:23:03 +02:00
bors[bot]
4567ae575e
Merge #5554
5554: Fix remove_dbg r=matklad a=petr-tik

Closes #5129 

Addresses two issues:
- keep the parens from dbg!() in case the call is chained or there is
semantic difference if parens are excluded
- Exclude the semicolon after the dbg!(); by checking if it was
accidentally included in the macro_call

investigated, but decided against:
fix ast::MacroCall extraction to never include semicolons at the end -
this logic lives in rowan.

Defensively shorten the macro_range if there is a semicolon token.
Deleted unneccessary temp variable macro_args

Renamed macro_content to "paste_instead_of_dbg", because it isn't a
simple extraction of text inside dbg!() anymore

Co-authored-by: petr-tik <petr-tik@users.noreply.github.com>
2020-07-29 21:59:03 +00:00
bors[bot]
bd5d236724
Merge #5563
5563: Check all targets for package-level tasks r=matklad a=SomeoneToIgnore

When invoking "Select Runnable" with the caret on a runnable with a specific target (test, bench, binary), append the corresponding argument for the `cargo check -p` module runnable.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-07-29 21:51:49 +00:00
petr-tik
6ea393a8d1 Addressed code review
replaced match with let-if variable assignment
removed the unnecessary semicolon_on_end variable
converted all code and expected test variables to raw strings
and inlined them in asserts
2020-07-29 22:12:53 +01:00
kjeremy
e51d1ddf5b cargo_metadata 0.11.1 and cargo update 2020-07-29 17:06:56 -04:00
Aleksey Kladov
63de7bbb5b
Update crates/rust-analyzer/src/cli/analysis_stats.rs
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-07-29 19:56:54 +02:00
Aleksey Kladov
ba585309ec Replace rand with oorandom 2020-07-29 19:49:10 +02:00
Aleksey Kladov
76202a2c73 Rename NomialDef -> AdtDef 2020-07-29 19:22:15 +02:00
Aleksey Kladov
3d28292157 Switch to ungrammar from ast_src
The primary advantage of ungrammar is that it (eventually) allows one
to describe concrete syntax tree structure -- with alternatives and
specific sequence of tokens & nodes.

That should be re-usable for:

* generate `make` calls
* Rust reference
* Hypothetical parser's evented API

We loose doc comments for the time being unfortunately. I don't think
we should add support for doc comments to ungrammar -- they'll make
grammar file hard to read. We might supply docs as out-of band info,
or maybe just via a reference, but we'll think about that once things
are no longer in flux
2020-07-29 19:18:25 +02:00
Aleksey Kladov
0d1357be05 Dead code 2020-07-29 17:35:12 +02:00
Aleksey Kladov
9fb1624c5e Remove dead code 2020-07-29 15:46:47 +02:00
Aleksey Kladov
dc18ff51c3 Remove dead code 2020-07-29 15:12:19 +02:00
Kirill Bulatov
85d71f4dff Run package-specific cargo check and test for all targets 2020-07-29 15:35:27 +03:00
bors[bot]
9a9ddcc297
Merge #5564
5564: SSR: Restrict to current selection if any r=davidlattimore a=davidlattimore

The selection is also used to avoid unnecessary work, but only to the file level. Further restricting unnecessary work is left for later.

Co-authored-by: David Lattimore <dml@google.com>
2020-07-29 09:23:33 +00:00
David Lattimore
fcb6b166fb SSR: Rename position and lookup_context to resolve_context 2020-07-29 19:20:40 +10:00
bors[bot]
04d2b7b256
Merge #5565
5565: SSR: Don't mix non-path-based rules with path-based r=matklad a=davidlattimore

If any rules contain paths, then we reject any rules that don't contain paths. Allowing a mix leads to strange semantics, since the path-based rules only match things where the path refers to semantically the same thing, whereas the non-path-based rules could match anything. Specifically, if we have a rule like `foo ==>> bar` we only want to match the `foo` that is in the current scope, not any `foo`. However "foo" can be parsed as a pattern (BIND_PAT -> NAME -> IDENT). Allowing such a rule through would result in renaming everything called `foo` to `bar`. It'd also be slow, since without a path, we'd have to use the slow-scan search mechanism.

Co-authored-by: David Lattimore <dml@google.com>
2020-07-29 08:55:34 +00:00
David Lattimore
3600c43f49 SSR: Don't mix non-path-based rules with path-based
If any rules contain paths, then we reject any rules that don't contain paths. Allowing a mix leads to strange semantics, since the path-based rules only match things where the path refers to semantically the same thing, whereas the non-path-based rules could match anything. Specifically, if we have a rule like `foo ==>> bar` we only want to match the `foo` that is in the current scope, not any `foo`. However "foo" can be parsed as a pattern (BIND_PAT -> NAME -> IDENT). Allowing such a rule through would result in renaming everything called `foo` to `bar`. It'd also be slow, since without a path, we'd have to use the slow-scan search mechanism.
2020-07-29 16:01:00 +10:00
David Lattimore
cf55806257 SSR: Restrict to current selection if any
The selection is also used to avoid unnecessary work, but only to the
file level. Further restricting unnecessary work is left for later.
2020-07-29 15:06:58 +10:00
Kirill Bulatov
bb1ae85ed0 Allow running more tests at once 2020-07-29 01:03:19 +03:00
Aleksey Kladov
b10e437039 Fix nameref parsing 2020-07-28 20:59:48 +02:00
Aleksey Kladov
97d309ea4b Bump test timeout for macs 2020-07-28 10:31:08 +02:00
petr-tik
6ea28c3779 Fixed #5129
Addresses two issues:
- keep the parens from dbg!() in case the call is chained or there is
semantic difference if parens are excluded
- Exclude the semicolon after the dbg!(); by checking if it was
accidentally included in the macro_call

investigated, but decided against:
fix ast::MacroCall extraction to never include semicolons at the end -
this logic lives in rowan.

Defensively shorten the macro_range if there is a semicolon token.
Deleted unneccessary temp variable macro_args

Renamed macro_content to "paste_instead_of_dbg", because it isn't a
simple extraction of text inside dbg!() anymore
2020-07-27 22:17:15 +01:00
petr-tik
01bdeaad71 Make all test fn names consistent in remove_dbg 2020-07-27 21:28:41 +01:00
petr-tik
63751d1c6b Added failing tests 2020-07-27 21:28:07 +01:00
bors[bot]
020a40335b
Merge #5547
5547: Fold multiline fn parameters r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-27 11:48:10 +00:00
Aleksey Kladov
aa09aa36e2 Fold multiline fn parameters 2020-07-27 13:42:36 +02:00
bors[bot]
bc9fab1565
Merge #5532
5532: Restore line index optimization for edits r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-27 09:49:45 +00:00
bors[bot]
91b2f0baaf
Merge #5539
5539: SSR: Fix path resolution of locals in current scope r=matklad a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-07-27 08:06:18 +00:00
Emil Gardström
2b8dcc15ac add completion for rustc lints 2020-07-27 02:23:21 +02:00
David Lattimore
b3ca36b2d9 SSR: Fix for path resolution of locals
It seems that Semantics::scope, if given a statement node, won't resolve
locals that were defined in the current scope, only in parent scopes.
Not sure if this is intended / expected behavior, but we work around it
for now by finding another nearby node to use as the scope (e.g. the
expression inside the EXPR_STMT).
2020-07-26 21:58:35 +10:00
David Lattimore
bb587fae1d SSR: Move more resolution-related code into the resolving module 2020-07-26 21:58:35 +10:00
Aleksey Kladov
524c2e9a7c Report type errors in metrics 2020-07-26 12:43:53 +02:00
Aleksey Kladov
da65cff18b Add one more test 2020-07-26 11:05:28 +02:00
Laurențiu Nicola
83a87fcd11 Restore line index micro-optimization 2020-07-25 12:56:39 +03:00
Aleksey Kladov
451edcc098 Add rustc-perf to metrics 2020-07-25 10:35:45 +02:00
bors[bot]
a09a00a560
Merge #5520
5520: Add DocumentData to represent in-memory document with LSP info r=matklad a=kjeremy

At the moment this only holds document version information but in the near-future it will hold other things like semantic token delta info.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-24 20:31:44 +00:00
bors[bot]
d7f1a53c6c
Merge #5524
5524: Allow opting out of experimental diagnostics like MismatchedArgCount r=matklad a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/5448
Closes https://github.com/rust-analyzer/rust-analyzer/issues/5419

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-24 20:18:01 +00:00
Jonas Schievink
92a4ec80a0 Only display experimental diagnostics when enabled 2020-07-24 17:39:44 +02:00
Jonas Schievink
f6f49735e8 Add toggle for experimental diagnostics 2020-07-24 17:39:16 +02:00
Jonas Schievink
bec5123b0a Mark MismatchedArgCount as experimental 2020-07-24 17:38:33 +02:00
Jonas Schievink
76509b3d2d Allow filtering diagnostics 2020-07-24 17:38:18 +02:00
Jonas Schievink
6f02befee4 Add a builder for DiagnosticSink 2020-07-24 16:30:12 +02:00
Aleksey Kladov
14a3a713c7 Revert "Merge #5516"
This reverts commit 5b13c2411f, reversing
changes made to c3defe2532.
2020-07-24 16:28:19 +02:00
bors[bot]
f4f106dcea
Merge #5522
5522: Increace tracing-tree version from 0.1.3 to 0.1.4 r=kjeremy a=vandenheuvel



Co-authored-by: Bram van den Heuvel <b.vandenheuvel@student.tudelft.nl>
2020-07-24 14:01:47 +00:00
bors[bot]
5b13c2411f
Merge #5516
5516: Better LSP conformance r=matklad a=vsrs

At the moment rust-analyzer does not fully conform to the LSP. This PR fixes two LSP related issues:

1) rust-analyzer sends predefined server capabilities and does not take supplied client capabilities in mind.
2) rust-analyzer uses dynamic `textDocument/didSave` registration even if the client does not support it.


Co-authored-by: vsrs <vit@conrlab.com>
2020-07-24 13:53:41 +00:00
Bram van den Heuvel
090f02bc18 Increace tracing-tree version from 0.1.3 to 0.1.4 2020-07-24 15:41:52 +02:00