Commit Graph

6025 Commits

Author SHA1 Message Date
Edwin Cheng
27943bead6 Remove progress bar and add a true counter 2019-11-27 04:34:06 +08:00
Edwin Cheng
97f6f141ee Remove commented code 2019-11-27 04:16:03 +08:00
Edwin Cheng
5b49ad5bd5 Use a simple progress bar instead of indicatif 2019-11-27 04:09:30 +08:00
bors[bot]
4d753fa6f5
Merge #2412
2412: Fix stale crates that snuck in r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-26 13:26:23 +00:00
Jeremy Kolb
b81548c73a Fix stale crates that snuck in 2019-11-26 08:20:40 -05:00
bors[bot]
4822d26540
Merge #2406
2406: Add hygiene information to SourceAnalyzer r=matklad a=edwin0cheng

This should fix https://github.com/rust-analyzer/rust-analyzer/pull/2392#issuecomment-557964686

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-26 13:18:03 +00:00
Edwin Cheng
0623164c1d Remove dbg! 2019-11-26 21:13:36 +08:00
bors[bot]
36dca8de93
Merge #2410
2410: Introduce hir_ty r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 12:42:15 +00:00
Aleksey Kladov
4e17718a9a Doc primitives 2019-11-26 15:41:48 +03:00
Aleksey Kladov
45d05ed783 id-ify impls_in_crate_query 2019-11-26 15:36:25 +03:00
bors[bot]
280946e597
Merge #2411
2411: Update parking_lot and smallvec to drop some dependencies r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-26 12:31:24 +00:00
Jeremy Kolb
8b1f2cd14e Update parking_lot and smallvec to drop some dependencies 2019-11-26 07:29:28 -05:00
Aleksey Kladov
4c43631829 Introduce hir_ty 2019-11-26 15:06:06 +03:00
bors[bot]
6e36eadd26
Merge #2409
2409: Id-ify Ty::Adt r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 11:32:09 +00:00
Aleksey Kladov
a443b5033c Id-ify Ty::Adt 2019-11-26 14:29:12 +03:00
bors[bot]
500e022f7d
Merge #2398
2398: WIP: introduce hir::Type r=matklad a=matklad

This introduces `hir::Type` wrapper over `hir::Ty`, with two purposes:

* bind `Ty` and it's corresponding environment
  * Am I correct that `Ty` without an env doesn't make much sense, because the meaning of type parameters is unclear
  * Am I correct that we can safely re-use the same environment for all types derived from the given type? 
* hide representation defails of `Ty`. Specifically, I want to change `Ty::Adt` to use `hir_def::AdtId` instead of `hir::Adt`, but IDE doesn't know about underlying IDs. More generally, I feel like IDE shouldn't know that `Ty` is enum.

@flodiebold what do you think about this?

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 11:05:05 +00:00
Aleksey Kladov
e5eadb3390 Introduce hir::Type
It should provide a convenient API over more low-level Ty
2019-11-26 14:02:57 +03:00
bors[bot]
5901cc7360
Merge #2408
2408: Use chalk fork to paper over #2052 r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 08:46:48 +00:00
Aleksey Kladov
0a7ef09331 Use chalk fork to paper over #2052 2019-11-26 11:46:09 +03:00
bors[bot]
cc1ef95d19
Merge #2407
2407: ⬆️ salsa r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 08:29:53 +00:00
Aleksey Kladov
131c2da6bf ⬆️ salsa 2019-11-26 11:29:20 +03:00
Edwin Cheng
245a9b165a Add hygiene information to SourceAnalyzer 2019-11-26 15:05:53 +08:00
bors[bot]
58a3b3b502
Merge #2404
2404: Use TypeAliasId in Ty, pt 2 r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-25 15:58:54 +00:00
Aleksey Kladov
1a0da6d4da Use TypeAliasId in Ty, pt 2 2019-11-25 18:58:17 +03:00
Aleksey Kladov
6d2ec8765d Use TypeAliasId in Ty, pt 1 2019-11-25 18:44:36 +03:00
Aleksey Kladov
3e32ac4f86 More ids in Ty 2019-11-25 18:31:48 +03:00
bors[bot]
ecd1204804
Merge #2403
2403: Fixme for union fields r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-25 14:51:17 +00:00
Aleksey Kladov
1455663ea1 Fixme for union fields 2019-11-25 17:50:49 +03:00
Aleksey Kladov
5fd68b5929 Fix hir for ast::UnionDef 2019-11-25 17:50:49 +03:00
Aleksey Kladov
e1c0bdaf75 Introduce dedicated AST node for union
Although structs and unions have the same syntax and differ only in
the keyword, re-using the single syntax node for both of them leads to
confusion in practice, and propagates further down the hir in an
upleasent way.

Moreover, static and consts also share syntax, but we use different
nodes for them.
2019-11-25 17:50:49 +03:00
bors[bot]
be00d74c7b
Merge #2388
2388: Show missing struct fields in the error message r=matklad a=Frizi

This provides the most interesting information about the "missing structure fields" error directly to the user.

Co-authored-by: Frizi <frizi09@gmail.com>
2019-11-25 13:42:36 +00:00
bors[bot]
df25dd4d88
Merge #2402
2402: Use ids for Callable r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-25 13:34:12 +00:00
Aleksey Kladov
78791d6fac Use ids for Callable 2019-11-25 16:26:52 +03:00
bors[bot]
69fa6403d5
Merge #2401
2401: Update crates r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-25 13:23:27 +00:00
Aleksey Kladov
9047a4ad46 Use more IDs 2019-11-25 16:16:41 +03:00
Jeremy Kolb
711c1a3e46 Update crates 2019-11-25 08:12:28 -05:00
bors[bot]
1a9717b072
Merge #2400
2400: Use GenericDefIdMore r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-25 12:57:53 +00:00
Aleksey Kladov
5f39c5794e Use GenericDefIdMore 2019-11-25 15:54:03 +03:00
bors[bot]
c46cea2ad8
Merge #2399
2399: Use GenericDefId more r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-25 12:39:45 +00:00
Aleksey Kladov
c2a16632d0 Use GenericDefId more 2019-11-25 15:39:12 +03:00
bors[bot]
9f7fcc6ecd
Merge #2397
2397: Remove Resolver from autoderef r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-25 10:12:03 +00:00
Aleksey Kladov
8c3e372835 Remove Resolver from autoderef
Resolver holds onto too much context, including local scopes. Let's
try to pass in only what is necessary -- the trait environment.
2019-11-25 13:10:26 +03:00
Aleksey Kladov
bd53bd80bf Push resolver up 2019-11-25 12:45:45 +03:00
bors[bot]
e00e6554dd
Merge #2362
2362: Expand compile_error! r=edwin0cheng a=kjeremy

Does not validate that the input is a string literal. I thought that I could `match_ast!` against the `macro_args` but that did not work. Even if it had I am not sure which error would be appropriate.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-25 04:51:42 +00:00
bors[bot]
a888441c47
Merge #2392
2392: Fix panic during the expansion of `column!` r=edwin0cheng a=marcogroppo

Fixes #2379. Well, this isn't the "proper" fix but it doesn't hurt, IMHO.

The problem is that `to_col_number`, called by `column_expand`, receives a position number that isn't included in the text range of the file. My (very limited) understanding is that the text is the one of the original file, while `pos` is relative to something else, probably the text of the macro. Notice that in this case the `column!` expansion seems to be triggered by `assert_eq!`, so we're in the middle of another expansion. This PR simply avoids the panic by checking the length of the text.

r? @edwin0cheng 


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-11-25 02:42:17 +00:00
Jeremy Kolb
67d3600f59 Expand compile_error! 2019-11-24 19:01:51 -05:00
Marco Groppo
ceb13a0494 Fix panic during the expansion of column! 2019-11-24 23:49:58 +01:00
bors[bot]
f7f9757b6b
Merge #2396
2396: Switch to variant-granularity field type inference r=flodiebold a=matklad

r? @flodiebold 

Previously, we had a `ty` query for each field. This PR switcthes to a query per struct, which returns an `ArenaMap` with `Ty`s. 

I don't know which approach is better. What is bugging me about the original approach is that, if we do all queries on the "leaf" defs, in practice we get a ton of queries which repeatedly reach into the parent definition to compute module, resolver, etc. This *seems* wasteful (but I don't think this is really what causes any perf problems for us). 

At the same time, I've been looking at Kotlin, and they seem to use the general pattern of analyzing the *parent* definition, and storing info about children into a `BindingContext`. 

I don't really which way is preferable. I think I want to try this approach, where query granularity generally mirrors the data granularity. The primary motivation for me here is probably just hope that we can avoid adding a ton of helpers to a `StructField`, and maybe in general avoid the need to switch to a global `StructField`, using `LocalStructFieldId` most of the time internally. 

For external API (ie, for `ra_ide_api`), I think we should continue with fine-grained `StructField::ty` approach, which internally fetches the table for the whole struct and indexes into it.

In terms of actual memory savings, the results are as follows:

```
This PR:
   142kb FieldTypesQuery (deps)
    38kb FieldTypesQuery

Status Quo:
   208kb TypeForFieldQuery (deps)
    18kb TypeForFieldQuery
```

Note how the table itself occupies more than twice as much space! I don't have an explanation for this: a plausible hypothesis is that single-field structs are very common and for them the table is a pessimisation. 

THere's noticiable wallclock time difference.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 21:45:26 +00:00
Aleksey Kladov
d06904e90c Switch to variant-granularity field type inference 2019-11-25 00:12:36 +03:00
bors[bot]
6a5dea778b
Merge #2394
2394: Implement HasModule for AdtId r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 19:52:15 +00:00