Commit graph

347 commits

Author SHA1 Message Date
Aleksey Kladov
62e62d1c23 Reformat? 2020-03-02 14:28:34 +01:00
bors[bot]
ea67e2346e
Merge #3384
3384: fix #2377 super::super::* r=flodiebold a=JoshMcguigan

Thanks @matklad for the detailed explanation on #2377. I believe this fixes it.

One thing I'm not sure about is you said the fix would involve changing `crates/ra_hir_def/src/path/lower/lower.rs`, but I only changed `crates/ra_hir_def/src/path/lower/lower_use.rs`. I'm not sure what kind of test code I'd have to write to expose the issue in `lower.rs`, but I'd be happy to add it if you are able to provide additional guidance. 

closes #2377

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-01 13:36:44 +00:00
Josh Mcguigan
0057d1e10d fix completion for super::super:: 2020-02-29 21:04:21 -08:00
Josh Mcguigan
69faf81e0d fix #2377 super::super::* 2020-02-29 19:48:55 -08:00
Aleksey Kladov
a1e1869554 Rename ast::ImplBlock -> ast::ImplDef 2020-02-29 21:33:15 +01:00
Shotaro Yamada
33de107ed9 Remove unused dependencies 2020-02-27 14:04:13 +09:00
bors[bot]
f9acb4333f
Merge #3260
3260: Refactor how builtins are resolved r=matklad a=flodiebold

This fixes autocompletion suggesting e.g. `self::usize`. (I thought we had a bug for that, but I didn't find it.)

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-02-22 11:25:09 +00:00
Florian Diebold
f1f45f9191 Fix handling of const patterns
E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).

Fixes #1618.
2020-02-21 17:01:19 +01:00
Florian Diebold
31af774254 Refactor how builtins are resolved
This fixes autocompletion suggesting e.g. self::usize.
2020-02-21 15:39:51 +01:00
Kirill Bulatov
f6816c253b Update versions 2020-02-18 16:12:40 +02:00
Kirill Bulatov
eceaf94f19 More manual clippy fixes 2020-02-18 16:12:37 +02:00
Kirill Bulatov
b8ddcb0652 Run cargo +nightly fix --clippy -Z unstable-options 2020-02-18 16:03:08 +02:00
bors[bot]
fcf15cc05a
Merge #3169
3169: Show record field names in Enum completion r=flodiebold a=adamrk

Adresses https://github.com/rust-analyzer/rust-analyzer/issues/2947.
Previously the details shown when autocompleting an Enum variant would look like the variant was a tuple even if it was a record:
![2020-02-16-15:59:32_crop](https://user-images.githubusercontent.com/16367467/74607233-64f21980-50d7-11ea-99db-e973e29c71d7.png)

This change will show the names of the fields for a record and use curly braces instead of parentheses:
![2020-02-16-15:33:00_crop](https://user-images.githubusercontent.com/16367467/74607251-8ce17d00-50d7-11ea-9d4d-38d198a4aec0.png)

This required exposing the type `adt::StructKind` from `ra_hir` and adding a function 
```
kind(self, db: &impl HirDatabase) -> StructKind
```
in the `impl` of `EnumVariant`. 

There was also a previously existing function `is_unit(self, db: &impl HirDatabase) -> bool` for `EnumVariant` which I removed because it seemed redundant after adding `kind`.

Co-authored-by: adamrk <ark.email@gmail.com>
2020-02-17 10:54:32 +00:00
Edwin Cheng
2d4e79e1e6 Introduce AsMacroCall trait 2020-02-17 12:57:24 +08:00
adamrk
68d3743faf replace uses of VariantData::is_unit with VariantData::kind 2020-02-16 16:10:32 +01:00
adamrk
04aff742b1 show names for record fields in enum completion 2020-02-16 16:10:23 +01:00
Benjamin Brittain
843f03a3d2 Bump crate resolution limit for large projects
Change-Id: Ie0221e5bcfd1779cd5e241f96b4489e5bd3854c1
2020-02-14 16:15:59 -05:00
Florian Diebold
001dd6a200 Make Self implement the trait inside trait default methods 2020-02-14 20:39:04 +01:00
bors[bot]
759100fb0d
Merge #3062
3062: Implement slice pattern AST > HIR lowering r=jplatte a=jplatte

WIP. The necessary changes for parsing are implemented, but actual inference is not yet. Just wanted to upload what I've got so far so it doesn't get duplicated :)

Will fix #3043

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2020-02-11 21:46:36 +00:00
Jonas Platte
a3b104aa6d
Implement slice pattern AST > HIR lowering 2020-02-11 22:33:11 +01:00
bors[bot]
f8d6d6f23b
Merge #3074
3074: Or patterns r=matthewjasper a=matthewjasper

Works towards #2458

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
2020-02-10 20:14:08 +00:00
Veetaha
139479e8a3 move to to_usize() 2020-02-10 01:57:43 +02:00
Matthew Jasper
8c8d0bb34f Add or- and parenthesized-patterns 2020-02-09 22:06:15 +00:00
Florian Diebold
dded90a748 Formatting 2020-02-07 18:28:10 +01:00
Florian Diebold
dbc14f9d57 First stab at desugaring bounds for APIT 2020-02-07 18:28:10 +01:00
Florian Diebold
93aa166748 wip lower impl trait to type args 2020-02-07 18:28:10 +01:00
bors[bot]
73c36fdbd2
Merge #2962
2962: Differentiate underscore alias from named aliases r=matklad a=zombiefungus

pre for Fixing Issue 2736 
edited to avoid autoclosing the issue

Co-authored-by: zombiefungus <divmermarlav@gmail.com>
2020-02-04 09:44:31 +00:00
zombiefungus
f4f71e361e include requested changes 2020-02-02 08:04:24 -05:00
zombiefungus
7d52715945 add new ImportAlias enum to differentiate no alias from an _ alias 2020-02-02 08:04:24 -05:00
Kirill Bulatov
6dae5cbb11 Require ModPath for importing 2020-02-02 14:06:51 +02:00
bors[bot]
3bdf2e0972
Merge #2917
2917: Prefer imports starting with std r=matklad a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2915

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-01-28 16:22:18 +00:00
Kirill Bulatov
713870ee0c Add the tests 2020-01-28 18:03:24 +02:00
Aleksey Kladov
4b9e5d5dd9 Publicize debug printing of CrateDefMap 2020-01-28 16:29:31 +01:00
Kirill Bulatov
762d293581 Apply the proposed refactoring 2020-01-28 17:19:41 +02:00
Kirill Bulatov
7a2e449424 Prefer imports starting with std 2020-01-28 01:02:06 +02:00
Jeremy Kolb
b89991daed Update crates 2020-01-26 10:46:45 -05:00
Aleksey Kladov
3ceb9a941a Remove dead code 2020-01-16 17:56:14 +01:00
Aleksey Kladov
81a45ca1b3 Make FromSource private 2020-01-16 16:08:46 +01:00
bors[bot]
c78d269b66
Merge #2837
2837: Accidentally quadratic r=matklad a=matklad

Our syntax highlighting is accdentally quadratic. Current state of the PR fixes it in a pretty crude way, looks like for the proper fix we need to redo how source-analyzer works. 

**NB:** don't be scared by diff stats, that's mostly a test-data file

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-15 19:38:10 +00:00
Aleksey Kladov
263401bf75 Rename 2020-01-15 17:44:12 +01:00
Aleksey Kladov
ccfe53376a Introduce SourceBinder 2020-01-15 16:52:28 +01:00
Aleksey Kladov
21ea62d292 Don't parse child modules when doing diagnostics 2020-01-15 14:42:57 +01:00
bors[bot]
86d2af9f7b
Merge #2803
2803: Fix various names, e.g. Iterator not resolving in core prelude r=matklad a=flodiebold

Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-11 23:00:37 +00:00
Florian Diebold
9dc1826cfa Fix various names, e.g. Iterator not resolving in core prelude
Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.
2020-01-11 23:37:58 +01:00
Florian Diebold
4496e2a06a Apply review suggestions 2020-01-11 23:33:04 +01:00
Florian Diebold
4d75430e91 Qualify some paths in 'add missing impl members' 2020-01-11 23:33:04 +01:00
Florian Diebold
460fa71c55 Use self 2020-01-11 23:33:04 +01:00
Florian Diebold
2906d188c2 Cleanup 2020-01-11 23:33:04 +01:00
Florian Diebold
38cd9f0c94 Handle cycles 2020-01-11 23:33:04 +01:00
Florian Diebold
b1325488ec Use query for importable locations 2020-01-11 23:33:04 +01:00