Commit graph

891 commits

Author SHA1 Message Date
Florian Diebold
9d72b14cfe Normalize assoc types in more places 2019-08-12 21:43:00 +02:00
Florian Diebold
11b9845afd Improve debug logging a bit 2019-08-12 21:43:00 +02:00
Florian Diebold
6265497523 Normalize associated types during inference 2019-08-12 21:43:00 +02:00
Florian Diebold
22724f37f3 Lower fully qualified associated type paths
I.e. `<T as Trait>::Foo`.
2019-08-12 21:43:00 +02:00
Florian Diebold
6cfdfdecba Add representations of associated types
This adds three different representations, copied from the Chalk model:
 - `Ty::Projection` is an associated type projection written somewhere in the
   code, like `<Foo as Trait>::Bar`.
 - `Ty::UnselectedProjection` is similar, but we don't know the trait
   yet (`Foo::Bar`).
 - The above representations are normalized to their actual types during type
   inference. When that isn't possible, for example for `T::Item` inside an `fn
   foo<T: Iterator>`, the type is normalized to an application type with
   `TypeCtor::AssociatedType`.
2019-08-12 21:43:00 +02:00
Florian Diebold
3a9a0bc968 Add another test for assoc type resolution 2019-08-12 21:43:00 +02:00
Evgenii P
475a93097f Use Source in Diagnostic and implement 2019-08-12 23:06:08 +07:00
Aleksey Kladov
6efc79b89d implement while let desugaring 2019-08-07 15:14:22 +02:00
Aleksey Kladov
39967a85e1 refactor if-let lowering
mainly to get rid of unwraps
2019-08-07 13:57:24 +02:00
Aleksey Kladov
4d6475ada0 refactor if lowering 2019-08-07 12:32:32 +02:00
bors[bot]
4912cc35af Merge #1634
1634: Implement .await completion for futures r=flodiebold a=eupn

Closes #1263 with completion for `.await` syntax for types that are implementing `std::future::Future` trait.

r? @flodiebold 

Co-authored-by: Evgenii P <eupn@protonmail.com>
2019-08-04 09:42:17 +00:00
Evgenii P
9f9c5aa659 rustfmt 2019-08-04 08:45:14 +07:00
Evgenii P
8597af8ed4 Idiomatic return 2019-08-04 08:08:46 +07:00
Evgenii P
d610adfc2b Employ early return pattern more 2019-08-04 08:03:17 +07:00
Evgenii P
4034ea9e4e source_binder.rs: fix order of imports 2019-08-04 07:56:29 +07:00
Alexander Andreev
83fe7b5fcb Resolve out of line modules inside inline module with attribute path
Fixed #1510
Fixed #1529
2019-08-03 19:44:59 +03:00
Evgenii P
6a94f203fc Use std::future::Future trait from stdlib 2019-08-03 17:07:20 +07:00
Evgenii P
858736c477 do fixup: remove unused import 2019-08-03 02:46:00 +07:00
Evgenii P
291bd81e74 Relax trait solving more for completion 2019-08-03 01:56:27 +07:00
Evgenii P
ab7774545c Use future lang item instead of hardcoded std::future::Future 2019-08-03 01:53:51 +07:00
Evgenii P
30bc3b93be rustfmt 2019-08-03 01:16:20 +07:00
Evgenii P
c417b98f02 Implement completion for the .await syntax 2019-08-03 01:15:43 +07:00
bors[bot]
a5fe9f7a87 Merge #1604
1604: Fix failing type interference for floating point literal r=matklad a=theotherphil

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/1592

Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
2019-07-29 19:02:39 +00:00
Phil Ellison
d79dc38e99 Move assist test, add literal type inference test 2019-07-29 19:02:03 +01:00
Alexander Andreev
3629268f71 Fixed request changes. 2019-07-29 15:16:58 +03:00
Alexander Andreev
538ec1122b Added resolve modules inside inline module
#1510
2019-07-29 09:54:40 +03:00
Ekaterina Babshukova
8e49bb664a show local variable types in completion 2019-07-23 19:26:27 +03:00
bors[bot]
443061e752 Merge #1570
1570: switch to upstream rowan's API r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-21 13:48:46 +00:00
Ekaterina Babshukova
5fe19d2fbd provide completion in struct patterns 2019-07-21 14:41:33 +03:00
Aleksey Kladov
d52ee59a71 streamline API 2019-07-21 13:28:58 +03:00
bors[bot]
dac6adbef9 Merge #1562
1562: Continue support for .await r=matklad a=unrealhoang

- add await expr to ast and HIR Expr
- infer type for `.await`

Co-authored-by: Unreal Hoang <unrealhoang@gmail.com>
2019-07-20 11:27:50 +00:00
Unreal Hoang
bacf926a77
infer type for await
by projecting inner_ty to Future::Output alias
2019-07-20 20:12:19 +09:00
Unreal Hoang
5ac9f5cdc7
add await expr to ast 2019-07-20 19:35:49 +09:00
Aleksey Kladov
f3bdbec1b6 rename range -> text_range 2019-07-20 12:58:27 +03:00
Aleksey Kladov
6d5d82e412 move debug_dump to fmt::Debug 2019-07-20 12:48:24 +03:00
Aleksey Kladov
8467ba8cdb flip syntax text to use internal iteration 2019-07-19 20:29:59 +03:00
Aleksey Kladov
a6df224f7d minor 2019-07-19 18:25:07 +03:00
Aleksey Kladov
5c594bcb48 cleanup casts 2019-07-19 18:22:00 +03:00
Aleksey Kladov
f9d9e0a1f7 several highlighting cleanups
* make stuff more type-safe by using `BindPat` instead of just `Pat`
* don't add `mut` into binding hash
* reset shadow counter when we enter a function
2019-07-19 16:09:32 +03:00
Aleksey Kladov
e2b28f5bb8 migrate ra_hir to the new rowan 2019-07-19 13:16:25 +03:00
Aleksey Kladov
df33e7685b use Parse in mbe 2019-07-18 23:19:04 +03:00
Ekaterina Babshukova
4abe03879b highlight mutable variables differently 2019-07-18 18:52:50 +03:00
Aleksey Kladov
0fb4b896e2 use more correct phantom types for ptrs 2019-07-18 18:13:32 +03:00
Florian Diebold
c8284d8424 Switch to Chalk master, without fuel 2019-07-15 08:49:55 +02:00
Florian Diebold
dcb0c02e3a Remove blacklist, instead mark Sized as non-enumerable
This seems to be enough to prevent hanging in rust-analyzer, Chalk and the rustc
repo.
2019-07-15 08:49:55 +02:00
Florian Diebold
e2bce9e7eb Cargo update, including updating Chalk 2019-07-14 18:22:47 +02:00
Florian Diebold
1e60ba8927 Have InferenceContext contain an InferenceResult instead of duplicating all fields 2019-07-14 18:22:47 +02:00
Florian Diebold
0a20770f46 Some renamings for clarity 2019-07-14 18:22:47 +02:00
Alexander Andreev
9c75f30272 Fixed request comments 2019-07-14 09:24:18 +03:00
Alexander Andreev
22b863c534 Fixed comments 2019-07-13 21:51:20 +03:00