Commit Graph

6042 Commits

Author SHA1 Message Date
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
Aleksey Kladov
a0e1dbb450 Implement HasModule for AdtId 2019-11-24 22:48:37 +03:00
bors[bot]
f16cff3cad
Merge #2393
2393: Simplify ADT fields r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 19:45:08 +00:00
Aleksey Kladov
586acef528 Simplify ADT fields 2019-11-24 22:44:24 +03:00
bors[bot]
09389ed1d4
Merge #2391
2391: Simplify r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 18:18:47 +00:00
Aleksey Kladov
191b1d238f Remove impl_block module 2019-11-24 21:17:37 +03:00
Aleksey Kladov
d87c16bea6 hir_def is fully doc'ed! 2019-11-24 21:00:50 +03:00
bors[bot]
64fc9ac965
Merge #2390
2390: Simplify r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 17:54:14 +00:00
Aleksey Kladov
e48430cbae Simplify 2019-11-24 20:53:42 +03:00
Aleksey Kladov
d157812cd1 Docs 2019-11-24 20:39:48 +03:00
bors[bot]
a58db5712f
Merge #2389
2389: Don't redo field resolution in the IDE r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 17:08:16 +00:00
Aleksey Kladov
63e3ea38d3 Don't redo field resolution in the IDE 2019-11-24 20:06:55 +03:00
Frizi
66f04e6be5 Show missing struct fields in the error message 2019-11-24 17:45:30 +01:00
bors[bot]
ac9ba5eb32
Merge #2387
2387: Simplify r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 16:06:58 +00:00
Aleksey Kladov
434f108ada Simplify 2019-11-24 19:01:19 +03:00
bors[bot]
b0581c2403
Merge #2381
2381: Add proc-macro crate type handling r=JasperDeSutter a=JasperDeSutter

Resolves the libproc_macro crate in crates that are the proc-macro type.
This doesn't seem the ideal implementation though, since the compiler still requires you to write `extern crate proc_macro;` (even in 2018 edition).

Co-authored-by: JasperDeSutter <jasper.desutter@gmail.com>
2019-11-24 15:59:47 +00:00
JasperDeSutter
6a8b4f873a add proc-macro crate type handling 2019-11-24 16:55:56 +01:00
Aleksey Kladov
f5e0a31eaf Cleanup nameres 2019-11-24 18:05:12 +03:00
Aleksey Kladov
855a629b14 Use Trace in raw_items 2019-11-24 17:49:49 +03:00
bors[bot]
775bd98e5c
Merge #2385
2385: Some docs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 14:36:31 +00:00
Aleksey Kladov
21cfa6d529 Some docs 2019-11-24 17:36:06 +03:00
Aleksey Kladov
99af523b68 Cleanup 2019-11-24 17:36:06 +03:00
Aleksey Kladov
326f066aa2 Reduce visibility 2019-11-24 17:36:06 +03:00
bors[bot]
5cc634fa60
Merge #2383
2383: Add alloc to the crate graph r=matklad a=marcogroppo

`alloc` has been added to the crate graph.

Completions work, but they are available even when the user has **not** declared an `extern crate alloc`. Is this the correct approach?

Fixes #2376.

Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-11-24 13:26:54 +00:00
bors[bot]
450b820b70
Merge #2384
2384: Nicer API for attrs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 13:05:25 +00:00
Aleksey Kladov
4b74fb1d89 Nicer API for attrs 2019-11-24 16:03:02 +03:00
Aleksey Kladov
1956d57ed4 Slightly reduce code duplication 2019-11-24 15:50:45 +03:00
Aleksey Kladov
8e36cb5860 Simplify 2019-11-24 15:28:45 +03:00
Aleksey Kladov
151180057b Simplify 2019-11-24 15:20:59 +03:00
Marco Groppo
e3f8e7d13d Add alloc to the sysroot 2019-11-24 13:19:47 +01:00
Aleksey Kladov
e0b06cb672 Switch to StaticLoc for statics 2019-11-24 15:18:12 +03:00
bors[bot]
982a32aca3
Merge #2382
2382: Remove ids module r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 11:28:51 +00:00
Aleksey Kladov
9c766db5ff Remove ids module 2019-11-24 14:25:48 +03:00
Aleksey Kladov
53506a7552 Pull macro up 2019-11-24 14:13:51 +03:00