]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoMerge #2430
bors[bot] [Wed, 27 Nov 2019 18:45:05 +0000 (18:45 +0000)]
Merge #2430

2430: rename ra_ide_api -> ra_ide r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoReformat
Aleksey Kladov [Wed, 27 Nov 2019 18:44:38 +0000 (21:44 +0300)]
Reformat

4 years agorename ra_ide_api -> ra_ide
Aleksey Kladov [Wed, 27 Nov 2019 18:32:33 +0000 (21:32 +0300)]
rename ra_ide_api -> ra_ide

4 years agoRename module_id -> local_id
Aleksey Kladov [Wed, 27 Nov 2019 18:31:51 +0000 (21:31 +0300)]
Rename module_id -> local_id

4 years agoMerge #2429
bors[bot] [Wed, 27 Nov 2019 18:27:45 +0000 (18:27 +0000)]
Merge #2429

2429: Move type inference to a separate crate r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoprune deps
Aleksey Kladov [Wed, 27 Nov 2019 18:23:31 +0000 (21:23 +0300)]
prune deps

4 years agoMove Ty
Aleksey Kladov [Wed, 27 Nov 2019 14:46:02 +0000 (17:46 +0300)]
Move Ty

4 years agoDecouple
Aleksey Kladov [Wed, 27 Nov 2019 13:48:48 +0000 (16:48 +0300)]
Decouple

4 years agoMerge #2428
bors[bot] [Wed, 27 Nov 2019 13:41:55 +0000 (13:41 +0000)]
Merge #2428

2428: Remove TypableDef r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove TypableDef
Aleksey Kladov [Wed, 27 Nov 2019 13:39:58 +0000 (16:39 +0300)]
Remove TypableDef

4 years agoCleanup imports
Aleksey Kladov [Wed, 27 Nov 2019 13:29:11 +0000 (16:29 +0300)]
Cleanup imports

4 years agoUse Id for variats
Aleksey Kladov [Wed, 27 Nov 2019 13:25:01 +0000 (16:25 +0300)]
Use Id for variats

4 years agoMore decoupling
Aleksey Kladov [Wed, 27 Nov 2019 13:02:33 +0000 (16:02 +0300)]
More decoupling

4 years agoDecouple more
Aleksey Kladov [Wed, 27 Nov 2019 12:56:20 +0000 (15:56 +0300)]
Decouple more

4 years agoMerge #2427
bors[bot] [Wed, 27 Nov 2019 09:51:02 +0000 (09:51 +0000)]
Merge #2427

2427: Decouple r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoDecouple
Aleksey Kladov [Wed, 27 Nov 2019 09:47:18 +0000 (12:47 +0300)]
Decouple

4 years agoMerge #2426
bors[bot] [Wed, 27 Nov 2019 09:34:54 +0000 (09:34 +0000)]
Merge #2426

2426: Decouple r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoDecouple
Aleksey Kladov [Wed, 27 Nov 2019 09:31:40 +0000 (12:31 +0300)]
Decouple

4 years agoCleanup imports
Aleksey Kladov [Wed, 27 Nov 2019 09:13:07 +0000 (12:13 +0300)]
Cleanup imports

4 years agoMerge #2425
bors[bot] [Wed, 27 Nov 2019 09:05:39 +0000 (09:05 +0000)]
Merge #2425

2425: Decouple r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoDecouple
Aleksey Kladov [Wed, 27 Nov 2019 09:02:54 +0000 (12:02 +0300)]
Decouple

4 years agoDecouple
Aleksey Kladov [Wed, 27 Nov 2019 08:40:10 +0000 (11:40 +0300)]
Decouple

4 years agoMerge #2424
bors[bot] [Wed, 27 Nov 2019 06:51:37 +0000 (06:51 +0000)]
Merge #2424

2424: Crate -> CrateId r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoCrate -> CrateId
Aleksey Kladov [Wed, 27 Nov 2019 06:42:55 +0000 (09:42 +0300)]
Crate -> CrateId

4 years agoMerge #2422
bors[bot] [Tue, 26 Nov 2019 21:02:32 +0000 (21:02 +0000)]
Merge #2422

2422: Use a simple progress bar instead of indicatif r=maklad a=edwin0cheng

![pb](https://user-images.githubusercontent.com/11014119/69669230-6a3d5a80-10cc-11ea-8ad7-4dccb10349c9.gif)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoFill all last text to space and return the cursor
Edwin Cheng [Tue, 26 Nov 2019 21:01:13 +0000 (05:01 +0800)]
Fill all last text to space and return the cursor

4 years agoRemove progress bar and add a true counter
Edwin Cheng [Tue, 26 Nov 2019 20:33:40 +0000 (04:33 +0800)]
Remove progress bar and add a true counter

4 years agoRemove commented code
Edwin Cheng [Tue, 26 Nov 2019 20:16:03 +0000 (04:16 +0800)]
Remove commented code

4 years agoUse a simple progress bar instead of indicatif
Edwin Cheng [Tue, 26 Nov 2019 20:09:30 +0000 (04:09 +0800)]
Use a simple progress bar instead of indicatif

4 years agoMerge #2421
bors[bot] [Tue, 26 Nov 2019 19:56:35 +0000 (19:56 +0000)]
Merge #2421

2421: Cleanup r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoCleanup
Aleksey Kladov [Tue, 26 Nov 2019 19:56:07 +0000 (22:56 +0300)]
Cleanup

4 years agoDecouple
Aleksey Kladov [Tue, 26 Nov 2019 19:26:47 +0000 (22:26 +0300)]
Decouple

4 years agoMerge #2420
bors[bot] [Tue, 26 Nov 2019 18:42:52 +0000 (18:42 +0000)]
Merge #2420

2420: Remove last traces of adt from Ty r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMerge #2418
bors[bot] [Tue, 26 Nov 2019 18:34:15 +0000 (18:34 +0000)]
Merge #2418

2418: Hide MacroCallLoc outside hir_expand  r=matklad a=edwin0cheng

This PR refactor `MacroCallLoc` such that it  be hided to become implementation details of hir_expand.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoRemove last traces of adt from Ty
Aleksey Kladov [Tue, 26 Nov 2019 18:25:17 +0000 (21:25 +0300)]
Remove last traces of adt from Ty

4 years agoMore precise NameKind::Self
Aleksey Kladov [Tue, 26 Nov 2019 18:18:26 +0000 (21:18 +0300)]
More precise NameKind::Self

4 years agoMerge #2419
bors[bot] [Tue, 26 Nov 2019 18:07:21 +0000 (18:07 +0000)]
Merge #2419

2419: Remove ns-polymorphic type_for_def r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove ns-polymorphic type_for_def
Aleksey Kladov [Tue, 26 Nov 2019 18:04:24 +0000 (21:04 +0300)]
Remove ns-polymorphic type_for_def

4 years agoHide MacroCallLoc
Edwin Cheng [Tue, 26 Nov 2019 17:33:08 +0000 (01:33 +0800)]
Hide MacroCallLoc

4 years agoMerge #2415
bors[bot] [Tue, 26 Nov 2019 16:31:20 +0000 (16:31 +0000)]
Merge #2415

2415: Add note r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoAdd note
Aleksey Kladov [Tue, 26 Nov 2019 16:30:57 +0000 (19:30 +0300)]
Add note

4 years agoCleanup imports
Aleksey Kladov [Tue, 26 Nov 2019 15:06:12 +0000 (18:06 +0300)]
Cleanup imports

4 years agoReduce visibility
Aleksey Kladov [Tue, 26 Nov 2019 15:02:50 +0000 (18:02 +0300)]
Reduce visibility

4 years agoUse TraitId in TraitRef
Aleksey Kladov [Tue, 26 Nov 2019 15:00:36 +0000 (18:00 +0300)]
Use TraitId in TraitRef

4 years agoMerge #2413
bors[bot] [Tue, 26 Nov 2019 14:45:31 +0000 (14:45 +0000)]
Merge #2413

2413: Remove another helper r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove another helper
Aleksey Kladov [Tue, 26 Nov 2019 14:42:21 +0000 (17:42 +0300)]
Remove another helper

4 years agoDoc
Aleksey Kladov [Tue, 26 Nov 2019 14:26:08 +0000 (17:26 +0300)]
Doc

4 years agoRemove assoc_type_by_name helper
Aleksey Kladov [Tue, 26 Nov 2019 14:21:29 +0000 (17:21 +0300)]
Remove assoc_type_by_name helper

4 years agoStore names in TraitData
Aleksey Kladov [Tue, 26 Nov 2019 14:12:16 +0000 (17:12 +0300)]
Store names in TraitData

4 years agoDetangle ty from traits a bit
Aleksey Kladov [Tue, 26 Nov 2019 13:59:24 +0000 (16:59 +0300)]
Detangle ty from traits a bit

4 years agoMerge #2412
bors[bot] [Tue, 26 Nov 2019 13:26:23 +0000 (13:26 +0000)]
Merge #2412

2412: Fix stale crates that snuck in r=kjeremy a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoFix stale crates that snuck in
Jeremy Kolb [Tue, 26 Nov 2019 13:20:40 +0000 (08:20 -0500)]
Fix stale crates that snuck in

4 years agoMerge #2406
bors[bot] [Tue, 26 Nov 2019 13:18:03 +0000 (13:18 +0000)]
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>
4 years agoRemove dbg!
Edwin Cheng [Tue, 26 Nov 2019 13:13:36 +0000 (21:13 +0800)]
Remove dbg!

4 years agoMerge #2410
bors[bot] [Tue, 26 Nov 2019 12:42:15 +0000 (12:42 +0000)]
Merge #2410

2410: Introduce hir_ty r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoDoc primitives
Aleksey Kladov [Tue, 26 Nov 2019 12:40:55 +0000 (15:40 +0300)]
Doc primitives

4 years agoid-ify impls_in_crate_query
Aleksey Kladov [Tue, 26 Nov 2019 12:27:33 +0000 (15:27 +0300)]
id-ify impls_in_crate_query

4 years agoMerge #2411
bors[bot] [Tue, 26 Nov 2019 12:31:24 +0000 (12:31 +0000)]
Merge #2411

2411: Update parking_lot and smallvec to drop some dependencies r=matklad a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoUpdate parking_lot and smallvec to drop some dependencies
Jeremy Kolb [Tue, 26 Nov 2019 12:29:28 +0000 (07:29 -0500)]
Update parking_lot and smallvec to drop some dependencies

4 years agoIntroduce hir_ty
Aleksey Kladov [Tue, 26 Nov 2019 11:35:23 +0000 (14:35 +0300)]
Introduce hir_ty

4 years agoMerge #2409
bors[bot] [Tue, 26 Nov 2019 11:32:09 +0000 (11:32 +0000)]
Merge #2409

2409: Id-ify Ty::Adt r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoId-ify Ty::Adt
Aleksey Kladov [Tue, 26 Nov 2019 11:29:12 +0000 (14:29 +0300)]
Id-ify Ty::Adt

4 years agoMerge #2398
bors[bot] [Tue, 26 Nov 2019 11:05:05 +0000 (11:05 +0000)]
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>
4 years agoIntroduce hir::Type
Aleksey Kladov [Tue, 26 Nov 2019 11:02:57 +0000 (14:02 +0300)]
Introduce hir::Type

It should provide a convenient API over more low-level Ty

4 years agoMerge #2408
bors[bot] [Tue, 26 Nov 2019 08:46:48 +0000 (08:46 +0000)]
Merge #2408

2408: Use chalk fork to paper over #2052 r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse chalk fork to paper over #2052
Aleksey Kladov [Tue, 26 Nov 2019 08:45:12 +0000 (11:45 +0300)]
Use chalk fork to paper over #2052

4 years agoMerge #2407
bors[bot] [Tue, 26 Nov 2019 08:29:53 +0000 (08:29 +0000)]
Merge #2407

2407: :arrow_up: salsa r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years ago:arrow_up: salsa
Aleksey Kladov [Tue, 26 Nov 2019 08:29:20 +0000 (11:29 +0300)]
:arrow_up: salsa

4 years agoAdd hygiene information to SourceAnalyzer
Edwin Cheng [Tue, 26 Nov 2019 07:05:53 +0000 (15:05 +0800)]
Add hygiene information to SourceAnalyzer

4 years agoMerge #2404
bors[bot] [Mon, 25 Nov 2019 15:58:54 +0000 (15:58 +0000)]
Merge #2404

2404: Use TypeAliasId in Ty, pt 2 r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse TypeAliasId in Ty, pt 2
Aleksey Kladov [Mon, 25 Nov 2019 15:58:17 +0000 (18:58 +0300)]
Use TypeAliasId in Ty, pt 2

4 years agoUse TypeAliasId in Ty, pt 1
Aleksey Kladov [Mon, 25 Nov 2019 15:44:36 +0000 (18:44 +0300)]
Use TypeAliasId in Ty, pt 1

4 years agoMore ids in Ty
Aleksey Kladov [Mon, 25 Nov 2019 15:31:48 +0000 (18:31 +0300)]
More ids in Ty

4 years agoMerge #2403
bors[bot] [Mon, 25 Nov 2019 14:51:17 +0000 (14:51 +0000)]
Merge #2403

2403: Fixme for union fields r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFixme for union fields
Aleksey Kladov [Mon, 25 Nov 2019 14:34:15 +0000 (17:34 +0300)]
Fixme for union fields

4 years agoFix hir for ast::UnionDef
Aleksey Kladov [Mon, 25 Nov 2019 14:30:50 +0000 (17:30 +0300)]
Fix hir for ast::UnionDef

4 years agoIntroduce dedicated AST node for union
Aleksey Kladov [Mon, 25 Nov 2019 13:55:09 +0000 (16:55 +0300)]
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.

4 years agoMerge #2388
bors[bot] [Mon, 25 Nov 2019 13:42:36 +0000 (13:42 +0000)]
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>
4 years agoMerge #2402
bors[bot] [Mon, 25 Nov 2019 13:34:12 +0000 (13:34 +0000)]
Merge #2402

2402: Use ids for Callable r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse ids for Callable
Aleksey Kladov [Mon, 25 Nov 2019 13:26:52 +0000 (16:26 +0300)]
Use ids for Callable

4 years agoMerge #2401
bors[bot] [Mon, 25 Nov 2019 13:23:27 +0000 (13:23 +0000)]
Merge #2401

2401: Update crates r=matklad a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoUse more IDs
Aleksey Kladov [Mon, 25 Nov 2019 13:16:41 +0000 (16:16 +0300)]
Use more IDs

4 years agoUpdate crates
Jeremy Kolb [Mon, 25 Nov 2019 13:12:28 +0000 (08:12 -0500)]
Update crates

4 years agoMerge #2400
bors[bot] [Mon, 25 Nov 2019 12:57:53 +0000 (12:57 +0000)]
Merge #2400

2400: Use GenericDefIdMore r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse GenericDefIdMore
Aleksey Kladov [Mon, 25 Nov 2019 12:41:53 +0000 (15:41 +0300)]
Use GenericDefIdMore

4 years agoMerge #2399
bors[bot] [Mon, 25 Nov 2019 12:39:45 +0000 (12:39 +0000)]
Merge #2399

2399: Use GenericDefId more r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse GenericDefId more
Aleksey Kladov [Mon, 25 Nov 2019 12:39:12 +0000 (15:39 +0300)]
Use GenericDefId more

4 years agoMerge #2397
bors[bot] [Mon, 25 Nov 2019 10:12:03 +0000 (10:12 +0000)]
Merge #2397

2397: Remove Resolver from autoderef r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove Resolver from autoderef
Aleksey Kladov [Mon, 25 Nov 2019 10:10:26 +0000 (13:10 +0300)]
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.

4 years agoPush resolver up
Aleksey Kladov [Mon, 25 Nov 2019 09:45:45 +0000 (12:45 +0300)]
Push resolver up

4 years agoMerge #2362
bors[bot] [Mon, 25 Nov 2019 04:51:42 +0000 (04:51 +0000)]
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>
4 years agoMerge #2392
bors[bot] [Mon, 25 Nov 2019 02:42:17 +0000 (02:42 +0000)]
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>
4 years agoExpand compile_error!
Jeremy Kolb [Mon, 25 Nov 2019 00:01:51 +0000 (19:01 -0500)]
Expand compile_error!

4 years agoFix panic during the expansion of `column!`
Marco Groppo [Sun, 24 Nov 2019 18:02:04 +0000 (19:02 +0100)]
Fix panic during the expansion of `column!`

4 years agoMerge #2396
bors[bot] [Sun, 24 Nov 2019 21:45:26 +0000 (21:45 +0000)]
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>
4 years agoSwitch to variant-granularity field type inference
Aleksey Kladov [Sun, 24 Nov 2019 20:48:39 +0000 (23:48 +0300)]
Switch to variant-granularity field type inference

4 years agoMerge #2394
bors[bot] [Sun, 24 Nov 2019 19:52:15 +0000 (19:52 +0000)]
Merge #2394

2394: Implement HasModule for AdtId r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoImplement HasModule for AdtId
Aleksey Kladov [Sun, 24 Nov 2019 19:47:58 +0000 (22:47 +0300)]
Implement HasModule for AdtId

4 years agoMerge #2393
bors[bot] [Sun, 24 Nov 2019 19:45:08 +0000 (19:45 +0000)]
Merge #2393

2393: Simplify ADT fields r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSimplify ADT fields
Aleksey Kladov [Sun, 24 Nov 2019 19:44:24 +0000 (22:44 +0300)]
Simplify ADT fields