Commit graph

1643 commits

Author SHA1 Message Date
Aleksey Kladov
e1d6b7f7c4 Use dedicated semantic highlight tag for parameters
closes #5106
2020-07-11 14:51:41 +02:00
Aleksey Kladov
8c4919c9fd Fix goto definition for type alias type parameters
closes https://github.com/rust-analyzer/rust-analyzer/issues/5042
2020-07-11 12:45:30 +02:00
Aleksey Kladov
3fc4916b53 Reduce visibility 2020-07-11 12:31:50 +02:00
Aleksey Kladov
a36ff4a100 Speed up completion 2020-07-11 01:26:24 +02:00
Aleksey Kladov
f4147f6a34 Dont expose ID 2020-07-10 14:11:31 +02:00
Aleksey Kladov
9c54537ecf Rename 2020-07-10 14:09:31 +02:00
Aleksey Kladov
b85042601d Goto type definition works for self 2020-07-10 14:08:35 +02:00
Jonas Schievink
63ce2c7b5f Add argument count mismatch diagnostic 2020-07-09 12:16:29 +02:00
bors[bot]
a33eefa3b2
Merge #5149
5149: Implement Chalk variable kinds r=flodiebold a=flodiebold

This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.)

Should fix the last remaining issue of #2534.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-07-01 18:41:06 +00:00
Florian Diebold
d5d485ef92 Implement Chalk variable kinds
This means we need to keep track of the kinds (general/int/float) of variables
in `Canonical`, which requires some more ceremony. (It also exposes some places
where we're not really dealing with canonicalization correctly -- another thing
to be cleaned up when we switch to using Chalk's types directly.)

Should fix the last remaining issue of #2534.
2020-07-01 20:40:38 +02:00
Jonas Schievink
6bde542a39 Split CrateImplDefs in inherent and trait impls
This makes the intention of inherent vs. trait impls somewhat more
clear and also fixes (?) an issue where trait impls with an unresolved
trait were added as inherent impls instead (hence the test changes).
2020-07-01 17:15:20 +02:00
Laurențiu Nicola
d89827f9e0 Make less code generic 2020-07-01 14:38:42 +03:00
Laurențiu Nicola
e8505f14d4 Try to reduce Semantics monomorphisations 2020-07-01 14:38:42 +03:00
bors[bot]
686e115e73
Merge #5158
5158: Use CrateName correctly r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 08:03:47 +00:00
Aleksey Kladov
80386ca5be Use Strings for display names 2020-07-01 10:03:07 +02:00
Laurențiu Nicola
5953cbd7ae Make SemanticsScope non-generic 2020-07-01 09:34:45 +03:00
Florian Diebold
8e8d2ffecb (Partially) fix handling of type params depending on type params
If the first type parameter gets inferred, that's still not handled correctly;
it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and
then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before
the `_` is instantiated into a type variable -- so afterwards, we have two type
variables without any connection to each other.
2020-06-29 16:10:20 +02:00
Paul Daniel Faria
b1992b469c Remove unneeded code, filename from tests, fix rebasing issues 2020-06-27 11:38:34 -04:00
Paul Daniel Faria
2ca52bbb32 Revert ide highlighting changes (addressing on another branch) 2020-06-27 10:16:19 -04:00
Paul Daniel Faria
f678e0d837 Add HighlightTag::Operator, use it for unsafe deref. Move unsafe validation to its own file 2020-06-27 10:13:14 -04:00
Paul Daniel Faria
daf1cac9f8 Move diagnostics back into expr, add tests for diagnostics, fix logic to account for derefs of raw ptrs 2020-06-27 10:09:29 -04:00
Paul Daniel Faria
0b95bed83f Add unsafe diagnostics and unsafe highlighting 2020-06-27 10:08:14 -04:00
Jonas Schievink
5a81427304 Measure ItemTree query memory usage 2020-06-24 16:53:16 +02:00
Jonas Schievink
4b03b39d5b draw the rest of the owl 2020-06-24 16:53:16 +02:00
Jonas Schievink
0e2602f75e Remove raw item query 2020-06-24 16:53:16 +02:00
Aleksey Kladov
dad1333b48 New VFS 2020-06-23 17:51:06 +02:00
BGluth
bdf7e70820 Enum variants with Self::[variant] now resolve (#4879) 2020-06-22 08:28:53 -06: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
Jonas Schievink
a91c2e94b7 Add new query to stats 2020-06-19 23:17:53 +02:00
bors[bot]
90a5c4626a
Merge #4851
4851: Add quickfix to add a struct field r=TimoFreiberg a=TimoFreiberg

Related to #4563 
I created a quickfix for record literals first because the NoSuchField diagnostic was already there.
To offer that quickfix for FieldExprs with unknown fields I'd need to add a new diagnostic (or create a `NoSuchField` diagnostic for those cases)

I think it'd make sense to make this a snippet completion (to select the generated type), but this would require changing the `Analysis` API and I'd like some feedback before I touch that.

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-06-19 15:08:52 +00:00
Jonas Schievink
ebd8233b3e Replace impls_in_trait with CrateImplDefs 2020-06-19 01:29:34 +02:00
vsrs
022fbefffa Apply suggestions from code review 2020-06-18 10:15:43 +03:00
vsrs
4b07c1e775 Add Type::walk method 2020-06-18 10:15:43 +03:00
vsrs
7ec0064409 Remove AdtOrTrait 2020-06-18 10:15:43 +03:00
vsrs
283ec13fc0 Fix type "items" order. 2020-06-18 10:15:43 +03:00
vsrs
c50157f330 Add Go to Type Definition hover action. 2020-06-18 10:15:43 +03:00
Timo Freiberg
f5ac313000 Add quickfix to add a struct field 2020-06-12 18:52:44 +02:00
bors[bot]
32157d48f4
Merge #4843
4843: Don't guess macro expansion crate r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-11 10:18:53 +00:00
Aleksey Kladov
fac7b0e252 Don't guess macro expansion crate 2020-06-11 12:13:14 +02:00
Jonas Schievink
7e83ed99a8 Respect casing when searching for imports 2020-06-10 16:04:55 +02:00
Jonas Schievink
56c7145993 Limit import map queries 2020-06-10 12:40:33 +02:00
Jonas Schievink
b01fb22494 ra_hir: expose import_map::search_dependencies 2020-06-10 12:38:58 +02:00
bors[bot]
2a3ab7f3b4
Merge #4689
4689: Implement return position impl trait / opaque type support r=matklad a=flodiebold

This is working, but I'm not that happy with how the lowering works. We might need an additional representation between `TypeRef` and `Ty` where names are resolved and `impl Trait` bounds are separated out, but things like inference variables don't exist and `impl Trait` is always represented the same way.

Also note that this doesn't implement correct handling of RPIT *inside* the function (which involves turning the `impl Trait`s into variables and creating obligations for them). That intermediate representation might help there as well.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-05 15:46:28 +00:00
Florian Diebold
0d2328f3ea Review fixes 2020-06-05 17:41:58 +02:00
Jonas Schievink
f085e592fe Measure memory usage of ImportMap 2020-06-05 13:10:43 +02:00
Paul Daniel Faria
a9cb2933fb Add highlight support for unsafe fn calls and raw ptr deref 2020-06-02 18:54:00 -04:00
bors[bot]
94889b6472
Merge #4592
4592: fix textedit range returned for completion when left token is a keyword r=bnjjj a=bnjjj

close #4545

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-27 13:22:26 +00:00
kjeremy
bee4f8f9fe Pass trivially copy types as copy 2020-05-26 14:12:13 -04:00
Benjamin Coenen
0e814a3b5f fix textedit range returned for completion when left token is a keyword #4545
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-24 16:47:35 +02:00
Benjamin Coenen
c6143742bd add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-21 10:48:42 +02:00