Florian Diebold
1f7f4578f7
Filter out error predicates in type bounds as well
2019-12-23 00:08:03 +01:00
Florian Diebold
4053fcfca0
Introduce our own Chalk TypeFamily, instead of using ChalkIr
...
It's not very different, except we can directly use Salsa IDs instead of casting
them. This means we need to refactor the handling of errors to get rid of
UNKNOWN_TRAIT though.
2019-12-23 00:08:03 +01:00
Florian Diebold
6b5efe5bda
Refactor Chalk integration some more
2019-12-23 00:08:03 +01:00
Florian Diebold
67a2555f6d
Update Chalk, clean up Chalk integration a bit
2019-12-23 00:08:03 +01:00
Aleksey Kladov
e424545c0f
Rudimentary name resolution for local items
2019-12-22 22:41:21 +01:00
bors[bot]
3ebf15c9b2
Merge #2626
...
2626: Recursive collect macros in impl items r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-21 10:12:18 +00:00
bors[bot]
1cbef27ff8
Merge #2625
...
2625: Clippy lints r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-21 06:12:36 +00:00
Edwin Cheng
360de5ba71
Recursive collect macros in impl items
2019-12-21 05:02:31 +08:00
kjeremy
0d5d63a80e
Clippy lints
2019-12-20 15:14:30 -05:00
bors[bot]
6eab968c60
Merge #2624
...
2624: Separate module item from module scope r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-20 19:51:03 +00:00
bors[bot]
f578cd2182
Merge #2623
...
2623: Add support macros in impl blocks r=matklad a=edwin0cheng
This PR add support for macros in impl blocks, which reuse `Expander` for macro expansion.
see also: #2459
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-20 19:42:46 +00:00
Edwin Cheng
ad81d1dbc1
Add support macros in impl blocks
2019-12-21 03:37:03 +08:00
Florian Diebold
44b00aed4a
Coerce closures to fn pointers
...
E.g. `let x: fn(A) -> B = |x| { y };`
2019-12-20 18:54:33 +01:00
Florian Diebold
9c3f00a906
Fix coercion of last expression in function body
2019-12-20 18:28:21 +01:00
Florian Diebold
2a8c9100bf
Handle closure return types
...
Fixes #2547 .
2019-12-20 18:16:11 +01:00
Aleksey Kladov
1b8ce5b37b
Move impls to ItemScope
2019-12-20 16:52:02 +01:00
bors[bot]
d590f6ce12
Merge #2592
...
2592: Add std::ops::Index support for infering r=edwin0cheng a=edwin0cheng
see also #2534
Seem like this can't fix #2534 for this case:
```rust
fn foo3(bar: [usize; 2]) {
let baz = bar[1]; // <--- baz is still unknown ?
println!("{}", baz);
}
```
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-20 14:36:53 +00:00
Aleksey Kladov
1234dda9ee
Use generic ItemLoc for impls
2019-12-20 13:47:44 +01:00
Aleksey Kladov
f42697e54b
Support for nested traits
2019-12-20 12:29:25 +01:00
Aleksey Kladov
ac5a3f611b
Support for nested ADT
2019-12-20 12:20:49 +01:00
Aleksey Kladov
94ad07af4b
Introduce ContainerId
2019-12-20 12:07:23 +01:00
Aleksey Kladov
8fc20b6503
Rename ContainerId -> AssocContainerId
2019-12-20 12:00:05 +01:00
Edwin Cheng
76d688a328
Use fill instread of for loop
2019-12-20 03:04:55 +08:00
Aleksey Kladov
ba12e83c26
Add body as a possible container for items
2019-12-19 18:12:46 +01:00
Kirill Bulatov
4ed78f80f4
Remove TruncateOptions struct
2019-12-19 16:43:41 +02:00
Edwin Cheng
b61ad6a964
Use build_for_def
2019-12-19 22:28:52 +08:00
Kirill Bulatov
14c167a9f6
Omit default parameter types
2019-12-19 12:27:33 +02:00
Edwin Cheng
dddee23f43
Add std::ops::Index support for infering
2019-12-19 12:45:07 +08:00
Aleksey Kladov
04715cbe1c
Forbid <T>::foo syntax in mod paths
2019-12-18 17:41:33 +01:00
Florian Diebold
91853590a9
Add test mark
2019-12-15 21:06:08 +01:00
Florian Diebold
6e1c2d0df8
Handle impl Trait more correctly
...
When calling a function, argument-position impl Trait is transparent; same for
return-position impl Trait when inside the function. So in these cases, we need
to represent that type not by `Ty::Opaque`, but by a type variable that can be
unified with whatever flows into there.
2019-12-15 18:56:38 +01:00
Florian Diebold
ac961b2614
Add test for unifying impl Trait
2019-12-15 17:45:32 +01:00
Aleksey Kladov
2619950b3b
Use different types for path with and without generics
2019-12-14 19:15:40 +01:00
Florian Diebold
f02fcc1644
Use path macro
2019-12-13 22:33:38 +01:00
Florian Diebold
6911bc89a7
Rename N! to name!
2019-12-13 22:33:38 +01:00
Florian Diebold
259c42f00e
Add macros for known names and paths
2019-12-13 22:33:37 +01:00
Emil Lauridsen
7705209051
Correctly infer - and ! using std::ops::{Neg,Not}
2019-12-13 12:45:38 +01:00
Emil Lauridsen
95dc2de8e9
Add helper for resolving associated type of trait in infer
2019-12-13 12:45:37 +01:00
Aleksey Kladov
56710f119b
Move enum&union to new loc
2019-12-12 15:11:57 +01:00
Aleksey Kladov
f135a8ea55
Move structs to new loc
2019-12-12 14:58:04 +01:00
Aleksey Kladov
82e9b24558
Move traits to the new loc
2019-12-12 14:36:14 +01:00
Aleksey Kladov
7b0644d81e
Switch to the new location for impls
2019-12-12 14:25:34 +01:00
Laurențiu Nicola
16df4d8fcb
chore: bump deps and use mainline chalk
2019-12-09 22:35:47 +02:00
Florian Diebold
d0c9bb0abf
Fix coercion from &Foo to an inference variable in a reference
...
We didn't try to unify within the reference, but we should.
2019-12-08 13:06:59 +01:00
bors[bot]
b236f6aa49
Merge #2466
...
2466: Handle partial resolve cases r=matklad a=edwin0cheng
Another try to fix #2443 :
We resolve all imports every time in `DefCollector::collect` loop even it is resolved previously.
This is because other unresolved imports and macros will bring in another `PerNs`, so we can only assume that it has been partially resolved.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-08 10:44:30 +00:00
Aleksey Kladov
88c5b1282a
Rename GenericParam -> TypeParam
...
We don't have LifetimeParam yet, but they are planned!
2019-12-07 20:25:48 +01:00
Aleksey Kladov
29b5e1ec2a
Reformat
2019-12-07 13:19:21 +01:00
Aleksey Kladov
d6c2b92409
Refactor parameter count tracking
2019-12-07 13:13:00 +01:00
Aleksey Kladov
8e9837df21
Remove idx and parent generics from generics
...
This makes `hir_def::GenericParams` flatter. The logic for
re-numbering the params is moved to hir instead.
2019-12-07 13:05:56 +01:00
Aleksey Kladov
30fefcc08c
Store GenericParams in arena
2019-12-07 13:05:56 +01:00