Commit graph

7084 commits

Author SHA1 Message Date
Jonas Schievink
f9e5ba7d40 Remove now-broken incremental test
The ItemTree tracks impl and trait items, so the CrateDefMap now needs
recomputing when those change
2020-06-24 16:53:16 +02:00
Jonas Schievink
0e2602f75e Remove raw item query 2020-06-24 16:53:16 +02:00
Jonas Schievink
7054e89d18 Fix test 2020-06-24 16:53:16 +02:00
Jonas Schievink
9d24412929 Move collector 2020-06-24 16:53:14 +02:00
Jonas Schievink
f9417bcf49 Draw the rest of the owl 2020-06-24 16:52:37 +02:00
Jonas Schievink
e24de2007f collector changes WIP 2020-06-24 16:52:37 +02:00
Jonas Schievink
696a7a5a41 lower traits 2020-06-24 16:52:37 +02:00
Jonas Schievink
34bc80650b Hook up query, add impls, lower moar 2020-06-24 16:52:37 +02:00
Aleksey Kladov
1d75d11d6c Start item tree 2020-06-24 16:52:37 +02:00
Aleksey Kladov
e6c61d5072 Cleanup project.json deserialization 2020-06-24 16:16:52 +02:00
Aleksey Kladov
a07cad16ab Rename json_project -> project_json 2020-06-24 16:03:24 +02:00
bors[bot]
97c4d06258
Merge #5015 #5027 #5028
5015: Account for updated module ids when determining whether a resolution is changed r=matklad a=Nashenas88

Fixes #4943

5027: Make Debug less verbose for VfsPath and use Display in analysis-stats r=matklad a=lnicola



5028: Remove namedExports config r=matklad a=lnicola

Fixes a warning:

```
(!) Plugin commonjs: The namedExports option from "@rollup/plugin-commonjs" is deprecated. Named exports are now handled automatically.
```

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-24 13:02:37 +00:00
Paul Daniel Faria
43c6f6c039 Fix formatting issue with glob shadow test 2020-06-24 08:50:59 -04:00
Aleksey Kladov
154cb8243b Be more explicit about absolute paths at various places 2020-06-24 14:39:34 +02:00
Paul Daniel Faria
dfd79907b8 Use a macro in push_res to simplify code, simplify glob_shadowed_def assertion 2020-06-24 08:20:41 -04:00
Laurențiu Nicola
c15c22139f Make Debug less verbose for VfsPath and use Display in analysis-stats 2020-06-24 14:07:03 +03:00
bors[bot]
dff62def2e
Merge #5023
5023: Fix string literal inference in match r=flodiebold a=lnicola

Fixes #5020 

r? @flodiebold 

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-24 10:40:47 +00:00
bors[bot]
414b731e7d
Merge #5024 #5026
5024: Simplify r=matklad a=matklad



bors r+
🤖

5026: Disable file watching when running slow tests r=matklad a=matklad

This should rid us of the intermittent test failure

https://github.com/rust-analyzer/rust-analyzer/pull/5017#issuecomment-648717983



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-24 10:31:20 +00:00
Aleksey Kladov
0a2b6087ec Simplify 2020-06-24 12:30:54 +02:00
Aleksey Kladov
a0b76161ab Disable file watching when running slow tests
This should rid us of the intermittent test failure

https://github.com/rust-analyzer/rust-analyzer/pull/5017#issuecomment-648717983
2020-06-24 12:27:13 +02:00
Laurențiu Nicola
2bd9f0f020 Fix string literal inference in match 2020-06-24 13:20:06 +03:00
Aleksey Kladov
5e7a1a1203 Simplify 2020-06-24 12:01:17 +02:00
Aleksey Kladov
04fe512f0d Simplify 2020-06-24 11:51:45 +02:00
Aleksey Kladov
9d64525daa Simplify 2020-06-24 11:50:53 +02:00
Aleksey Kladov
d4a493078a Simplify 2020-06-24 11:48:44 +02:00
Aleksey Kladov
c749fe223b Remove duplication 2020-06-24 11:31:30 +02:00
Aleksey Kladov
c6795fb83a More consistent usage of fixtures 2020-06-24 11:29:43 +02:00
Aleksey Kladov
e9cb818c26 Use fixtures more 2020-06-24 11:05:47 +02:00
Aleksey Kladov
08e2149eab Simplify 2020-06-24 10:28:28 +02:00
bors[bot]
c544f9a137
Merge #4940
4940: Add support for marking doctest items as distinct from normal code r=ltentrup a=Nashenas88

This adds `HighlightTag::Generic | HighlightModifier::Injected` as the default highlight for all elements within a doctest. Please feel free to suggest that a new tag be created or a different one used.

![Screenshot from 2020-06-23 09-18-13](https://user-images.githubusercontent.com/1673130/85408493-9752ce00-b532-11ea-94fe-197353ccc778.png)

Fixes #4929 
Fixes #4939

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-24 05:22:23 +00:00
Paul Daniel Faria
38af81f183 Account for updated module ids when determining whether a resolution is "changed" 2020-06-23 22:10:01 -04:00
Paul Daniel Faria
0d87eee3a9 Improve readability be replacing hard-to-read if-else branches with a match 2020-06-23 19:35:09 -04:00
Aleksey Kladov
d016cb4867 Use only one code-path for parsing fixtures
This removes leading newlines everywhere, shifting all ranges in tests
by one
2020-06-24 00:48:38 +02:00
Aleksey Kladov
e5101ae150 Centralize fixture parsing for assists 2020-06-24 00:30:34 +02:00
Aleksey Kladov
7ce122b1df Remove useless test code 2020-06-23 23:45:40 +02:00
Aleksey Kladov
aa69757a01 More principled indentation trimming in fixtures 2020-06-23 23:33:41 +02:00
Aleksey Kladov
f2f69e75c8 Minor, rename 2020-06-23 22:51:33 +02:00
Aleksey Kladov
ff687453a8 Slightly better name 2020-06-23 21:29:50 +02:00
Aleksey Kladov
295c8d4f7f Complicate
Fixing test fallout unfortunately requires more work, we need to do
it, but let's merge something at least!
2020-06-23 20:38:36 +02:00
Aleksey Kladov
a34f9b7fb3 Docs for Fixture 2020-06-23 18:58:45 +02:00
Aleksey Kladov
84cd28fddc Cut problematic dependency 2020-06-23 18:56:26 +02:00
Aleksey Kladov
fdf86aee18 Nicer API 2020-06-23 18:46:56 +02:00
Aleksey Kladov
3486b47e5c Simplify 2020-06-23 18:43:55 +02:00
Paul Daniel Faria
a8a606cdc4 Remove unrelated change 2020-06-23 12:40:55 -04:00
Aleksey Kladov
21f751a0e5 Simplify 2020-06-23 18:37:26 +02:00
Aleksey Kladov
30748161f0 Simplify 2020-06-23 18:37:26 +02:00
Aleksey Kladov
6996ec860b Drop rarely used fixture functionality 2020-06-23 18:37:26 +02:00
Aleksey Kladov
f304874c8c Move fixtures to a separate file 2020-06-23 18:37:26 +02:00
Paul Daniel Faria
1e9095ae8c
Update comment for pop_and_inject
Co-authored-by: Leander Tentrup <ltentrup@users.noreply.github.com>
2020-06-23 12:15:45 -04:00
Paul Daniel Faria
2a56323537 Update injection mechanism and stop injecting through highlight element, switch to more general new highlight tag, generic 2020-06-23 12:13:50 -04:00
Paul Daniel Faria
d8230acd84 Add punctuation highlighting for highlighting punctuation in doctests, fix highlighting in doctests 2020-06-23 12:11:33 -04:00
Paul Daniel Faria
e137d9accb Add default color and opacity for documentation and injected, respectively, in the html generator 2020-06-23 12:08:04 -04:00
Paul Daniel Faria
351bba9bee Add support for marking doctest items as distinct from normal code, add default tag to all doctest elements 2020-06-23 12:08:04 -04:00
Aleksey Kladov
dad1333b48 New VFS 2020-06-23 17:51:06 +02:00
bors[bot]
7aa66371ee
Merge #5010
5010: Remove relative-path dependency r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-23 15:04:42 +00:00
Aleksey Kladov
676e82bb83 Remove relative-path dependency 2020-06-23 17:04:10 +02:00
bors[bot]
c0b9ae5503
Merge #5004
5004: Fix panic in split/merge import assists r=matklad a=lnicola

Fixes #4368 #4905

Not sure if this is the best solution here. Maybe the `make` functions should be fallible? We generally seem to be playing whack-a-mole with panics in assists, although most of them are `unwrap`s in the assist code.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-23 14:55:03 +00:00
Laurențiu Nicola
76ddface08 Fix panic in split and merge import assists 2020-06-23 16:51:07 +03:00
bors[bot]
3e09dbba94
Merge #5002
5002: Fix underflow panic when doctests are at top of file r=Nashenas88 a=Nashenas88

While debugging a comment at the top of a test string, I discovered that the offset calculations could underflow and panic. This only seemed to occur in tests, I assume because it's running a debug mode. The wrapping is quickly fixed later on in release mode, which is why this seems to have gone unnoticed. The new checks ensure the value is always positive or zero.

Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-23 13:25:43 +00:00
bors[bot]
338b229b79
Merge #4999
4999: SSR: Allow matching of whole macro calls r=matklad a=davidlattimore

Matching within macro calls is to come later and matching of macro calls within macro calls later still.

Co-authored-by: David Lattimore <dml@google.com>
2020-06-23 10:02:59 +00:00
Paul Daniel Faria
0b971625c3 Fix underflow panic when doctests are at top of file 2020-06-22 22:29:08 -04:00
bors[bot]
98c3e4e887
Merge #5000
5000: Remove RelativePathBuf from fixture r=matklad a=matklad

The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-22 22:15:22 +00:00
Aleksey Kladov
6a6098d4c3 Remove RelativePathBuf from fixture
The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.
2020-06-23 00:14:44 +02:00
David Lattimore
467af611fb SSR: Allow matching of whole macro calls
Matching within macro calls is to come later and matching of macro calls within macro calls later still.
2020-06-23 07:42:34 +10:00
bors[bot]
eabbeec14c
Merge #4988
4988: Don't offer to add missing fields of unknown types r=flodiebold a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-22 15:47:22 +00:00
Laurențiu Nicola
acc2819c10 Don't offer to add missing fields of unknown types 2020-06-22 18:16:00 +03:00
bors[bot]
87615166af
Merge #4900
4900: Self variant enum res fix r=BGluth a=BGluth

Fixes #4789.

This is my first PR for this project, so it's probably worth giving it an extra close look.

A few things that I wasn't sure about:
- Is `resolve_path` really the best place to perform this check? It seemed like a natural place, but perhaps there's a better place?
- When handling the new variant `PathResolution::VariantDef`, I couldn't see an obvious variant of `TypeNs` to return in `in_type_ns` for Unions and Structs.

Co-authored-by: BGluth <gluthb@gmail.com>
2020-06-22 14:37:45 +00:00
BGluth
bdf7e70820 Enum variants with Self::[variant] now resolve (#4879) 2020-06-22 08:28:53 -06:00
Aleksey Kladov
7c9f97ecb8 Add paths::RelPath[Buf] 2020-06-22 15:03:37 +02:00
bors[bot]
d8842e89e9
Merge #4899
4899: don't complete top level attrs inside nested attrs and add better labels r=matklad a=bnjjj

close #4890

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-22 12:13:18 +00:00
bors[bot]
d144d69d2e
Merge #4921
4921: Allow SSR to match type references, items, paths and patterns r=davidlattimore a=davidlattimore

Part of #3186

Co-authored-by: David Lattimore <dml@google.com>
2020-06-22 11:50:34 +00:00
David Lattimore
662ab2ecc8 Allow SSR to match type references, items, paths and patterns
Part of #3186
2020-06-22 21:42:55 +10:00
Benjamin Coenen
5aad6c9fa6 don't complete top level attrs inside nested attrs and add better labels #4899
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-22 13:39:05 +02:00
bors[bot]
19701b39ac
Merge #4928
4928: Fix renaming mod in use tree r=matklad a=unexge

Fixes #4825

Co-authored-by: unexge <unexge@gmail.com>
2020-06-22 11:19:09 +00:00
BGluth
3a3b40a554 Created goto Self enum variant test 2020-06-21 13:27:16 -06:00
Benjamin Coenen
3df879f139 don't complete top level attrs inside nested attrs and add better labels #4899
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-21 19:14:08 +02:00
Jeremy Kolb
a120ceed19 Update test for new serde 2020-06-21 12:10:50 -04:00
Jonas Schievink
500d8b2f60 Handle bindings after @ in patterns 2020-06-21 15:19:38 +02:00
bors[bot]
6d0a765d34
Merge #4962
4962: Implement APIs for parsing expressions, types, paths, patterns and items r=davidlattimore a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-06-21 12:37:29 +00:00
David Lattimore
bc99e95d7d Implement APIs for parsing expressions, types, paths, patterns and items 2020-06-21 22:28:17 +10:00
bors[bot]
50dad50188
Merge #4959
4959: Syntax highlighting for documentation comments on macro definitions r=matklad a=ltentrup

Two minor changes with regards to syntax highlighting of comments attached to macro definitions.

Before
<img width="290" alt="Bildschirmfoto 2020-06-20 um 00 05 19" src="https://user-images.githubusercontent.com/201808/85182705-c561b500-b289-11ea-944e-0bdf6508a44f.png">

After
<img width="288" alt="Bildschirmfoto 2020-06-20 um 00 03 36" src="https://user-images.githubusercontent.com/201808/85182727-d90d1b80-b289-11ea-9d2d-234731f19302.png">
Fixes #4949

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-06-21 12:05:16 +00:00
bors[bot]
04d64267de
Merge #4947
4947: Replace `impls_in_trait` query with smarter use of `CrateImplDefs` r=matklad a=jonas-schievink

`impls_in_trait` was allocating a whopping ~400 MB of RAM when running analysis-stats on r-a itself.

Remove it, instead adding a query that computes a summary `CrateImplDefs` map for all transitive dependencies. This can probably still be made more efficient, but this already reduces the peak memory usage by 25% without much performance impact on analysis-stats.

**Before**:

```
Total: 34.962107188s, 2083mb allocated 2141mb resident
   422mb ImplsForTraitQuery (deps)
   250mb CrateDefMapQueryQuery
   147mb MacroArgQuery
   140mb TraitSolveQuery (deps)
    68mb InferQueryQuery (deps)
    62mb ImplDatumQuery (deps)
```

**After**:

```
Total: 35.261100358s, 1520mb allocated 1569mb resident
   250mb CrateDefMapQueryQuery
   147mb MacroArgQuery
   144mb TraitSolveQuery (deps)
    68mb InferQueryQuery (deps)
    61mb ImplDatumQuery (deps)
    45mb BodyQuery
    45mb ImplDatumQuery
```

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-06-20 22:14:21 +00:00
Aleksey Kladov
f3cf85ab48 Move ReqQueue to lsp-server 2020-06-20 23:24:16 +02:00
bors[bot]
b575b02449
Merge #4961
4961: Centralize handing of in-flight requests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-20 19:39:41 +00:00
bors[bot]
c8557b91a3
Merge #4958
4958: Infer FnSig via Fn traits r=flodiebold a=adamrk

Addresses https://github.com/rust-analyzer/rust-analyzer/issues/4481.
When inferring types check if the callee implements one of the builtin `Fn` traits. Also autoderef the callee before trying to figure out it's `FnSig`. 

Co-authored-by: adamrk <ark.email@gmail.com>
2020-06-20 15:10:35 +00:00
adamrk
1629fb770e Push obligation instead of matching on solution 2020-06-20 17:00:57 +02:00
Aleksey Kladov
93605c49ba Centralize handing of in-flight requests 2020-06-20 13:06:11 +02:00
adamrk
d8f5192d99 Get Output assoc type by name 2020-06-20 11:53:55 +02:00
adamrk
f07338bae2 Add test for dyn Fn Output 2020-06-20 11:43:40 +02:00
adamrk
436dcd9656 move tests to ra_hir_ty 2020-06-20 11:32:01 +02:00
adamrk
f0c8058f12 Fixes to callable_sig_from_fn_trait 2020-06-20 11:04:46 +02:00
adamrk
38f6cdbc8a Make get_fn_trait a method of FnTrait 2020-06-20 08:42:35 +02:00
adamrk
cf870af807 Switch back callable_sig for known fn types 2020-06-20 08:26:31 +02:00
Jonas Schievink
a3c2f5126f Recursively compute impl sets 2020-06-20 00:36:02 +02:00
Leander Tentrup
df5b37cb61 Syntax highlighting for documentation comments on macro definitions 2020-06-20 00:02:42 +02:00
bors[bot]
0f7961d557
Merge #4952
4952: Shift bound variables correctly when using assoc type shorthand r=matklad a=flodiebold

Fixes #4885.
Fixes #4800.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-19 21:40:59 +00:00
bors[bot]
af0dcc5481
Merge #4951
4951: Don't panic on crates depending on themselves r=matklad a=flodiebold

Fixes #3883.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-19 21:28:32 +00:00
Jonas Schievink
a91c2e94b7 Add new query to stats 2020-06-19 23:17:53 +02:00
adamrk
3f94a90c7b Infer FnSig from Fn traits 2020-06-19 22:51:25 +02:00
Jonas Schievink
aa8442af70 Don't include downstream crate in query 2020-06-19 22:33:13 +02:00