Aleksey Kladov
59f91f2f9b
Less confusing profile names
2020-03-06 16:40:38 +01:00
bors[bot]
aa82b5915d
Merge #3494
...
3494: Implement include macro r=matklad a=edwin0cheng
This PR implement builtin `include` macro.
* It does not support include as expression yet.
* It doesn't consider `env!("OUT_DIR")` yet.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-06 15:08:41 +00:00
Edwin Cheng
0a06c7e6e6
Implment include macro
2020-03-06 22:58:45 +08:00
Florian Diebold
073a1ef834
Support aliases and Self in struct literals
...
Fixes #3306 .
2020-03-06 15:43:14 +01:00
Aleksey Kladov
fb5891c433
Source map returns a result
...
cc #2236
2020-03-06 14:44:44 +01:00
Edwin Cheng
e04c0f4222
Fix panic on eager expansion
2020-03-04 02:41:33 +08:00
Edwin Cheng
fe04c28b59
Add test
2020-03-04 01:21:14 +08:00
Laurențiu Nicola
91e02ace06
Drop larlpop-intern dep
2020-03-03 07:57:16 +02:00
Laurențiu Nicola
f60cf882a8
Update chalk for Ty interners
2020-03-03 00:02:19 +02:00
Laurențiu Nicola
807a56bebf
Update chalk for RawId removal
2020-03-02 23:30:38 +02:00
bors[bot]
02f761ba4b
Merge #3397 #3398
...
3397: Minimal viable meta r=matklad a=matklad
bors r+
🤖
3398: Reformat? r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-02 13:31:56 +00:00
Aleksey Kladov
62e62d1c23
Reformat?
2020-03-02 14:28:34 +01:00
bors[bot]
79c874803b
Merge #3385
...
3385: Fix #3373 r=matklad a=flodiebold
Basically, we need to allow variables in the caller self type to unify with the
impl's declared self type. That requires some more contortions in the variable
handling. I'm looking forward to (hopefully) handling this in a cleaner way when
we switch to Chalk's types and unification code.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-03-02 13:23:24 +00:00
Josh Mcguigan
f5efa17515
handle array pattern matching type inference
2020-03-01 14:02:32 -08:00
Josh Mcguigan
b9ef7a6b98
remove match statement, handle suffix
2020-03-01 12:13:05 -08:00
Josh Mcguigan
d0e282f6b1
handle arbitrary length slices
2020-03-01 07:35:15 -08:00
Josh Mcguigan
f353625705
match single prefix slice
2020-03-01 06:25:38 -08:00
Florian Diebold
336a3c6121
Fix #3373
...
Basically, we need to allow variables in the caller self type to unify with the
impl's declared self type. That requires some more contortions in the variable
handling. I'm looking forward to (hopefully) handling this in a cleaner way when
we switch to Chalk's types and unification code.
2020-03-01 14:31:35 +01:00
Florian Diebold
31171eed5e
Do autoderef for indexing
2020-02-29 22:48:53 +01:00
Florian Diebold
e313efb992
Do array unsizing for method receivers
...
It turns out rustc actually only unsizes array method receivers, so we don't
need to do any trait solving for this (at least for now).
Fixes #2670 .
2020-02-29 22:48:53 +01:00
Aleksey Kladov
a1e1869554
Rename ast::ImplBlock -> ast::ImplDef
2020-02-29 21:33:15 +01:00
Florian Diebold
5fe220b987
Fix a common false-positive type mismatch
...
E.g. for `&{ some_string() }` in a context where a `&str` is expected, we
reported a mismatch inside the block. The problem is that we're passing an
expectation of `str` down, but the expectation is more of a hint in this case.
There's a long comment in rustc about this, which I just copied.
Also, fix reported location for type mismatches in macros.
2020-02-29 15:31:07 +01:00
Aleksey Kladov
c6247f74c7
Basic injections
2020-02-27 16:16:13 +01:00
Laurențiu Nicola
ed69482d90
Bump chalk and replace TypeFamily with Interner
2020-02-24 22:36:57 +02:00
Florian Diebold
5a6e770f99
Shorten some code
2020-02-22 13:15:54 +01:00
Florian Diebold
3e106c77ff
Rework find_super_trait_path to protect against cycles
2020-02-22 13:14:39 +01:00
Florian Diebold
c200025794
Fix shift_bound_vars
...
It should only shift free vars (maybe the name isn't the best...)
2020-02-22 11:09:21 +01:00
Florian Diebold
463df6720c
Fix wrong handling of bare dyn Trait
exposed by canonicalizer fix
...
The self type in the `dyn Trait` trait ref should always be ^0, but we didn't
put that in there in the bare case.
2020-02-22 11:09:21 +01:00
Florian Diebold
2d5ab63247
Add &dyn Trait -> &dyn SuperTrait coercion, and fix &T -> &dyn Trait
2020-02-22 11:09:21 +01:00
Florian Diebold
f126808b2e
Fix handling of binders in canonicalization
...
I'm looking forward to getting rid of this in favor of Chalk's implementation.
2020-02-22 11:09:21 +01:00
Florian Diebold
0dfbbaf03b
Implement dyn Trait unsizing as well
2020-02-22 11:09:21 +01:00
Florian Diebold
de39d221a1
Implement unsize coercion using proper trait solving
2020-02-22 11:09:21 +01:00
Florian Diebold
f1f45f9191
Fix handling of const patterns
...
E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).
Fixes #1618 .
2020-02-21 17:01:19 +01:00
Florian Diebold
e50201345e
Normalize associated types in types coming from Chalk
...
Fixes #3232 .
2020-02-21 14:06:19 +01:00
bors[bot]
e00b9ca3c9
Merge #3215
...
3215: Exclude methods from non-parameter types introduced by generic constraints r=flodiebold a=lnicola
Fixes #3184 .
r? @flodiebold
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-19 19:46:37 +00:00
Aleksey Kladov
9549aad525
Fill missing fields of enum variants
2020-02-19 18:17:09 +01:00
Laurențiu Nicola
5b05209744
Exclude methods from non-parameter types introduced by generic constraints
2020-02-19 10:46:13 +02:00
Kirill Bulatov
f6816c253b
Update versions
2020-02-18 16:12:40 +02:00
Kirill Bulatov
eceaf94f19
More manual clippy fixes
2020-02-18 16:12:37 +02:00
Kirill Bulatov
b8ddcb0652
Run cargo +nightly fix --clippy -Z unstable-options
2020-02-18 16:03:08 +02:00
bors[bot]
fcf15cc05a
Merge #3169
...
3169: Show record field names in Enum completion r=flodiebold a=adamrk
Adresses https://github.com/rust-analyzer/rust-analyzer/issues/2947 .
Previously the details shown when autocompleting an Enum variant would look like the variant was a tuple even if it was a record:
![2020-02-16-15:59:32_crop](https://user-images.githubusercontent.com/16367467/74607233-64f21980-50d7-11ea-99db-e973e29c71d7.png )
This change will show the names of the fields for a record and use curly braces instead of parentheses:
![2020-02-16-15:33:00_crop](https://user-images.githubusercontent.com/16367467/74607251-8ce17d00-50d7-11ea-9d4d-38d198a4aec0.png )
This required exposing the type `adt::StructKind` from `ra_hir` and adding a function
```
kind(self, db: &impl HirDatabase) -> StructKind
```
in the `impl` of `EnumVariant`.
There was also a previously existing function `is_unit(self, db: &impl HirDatabase) -> bool` for `EnumVariant` which I removed because it seemed redundant after adding `kind`.
Co-authored-by: adamrk <ark.email@gmail.com>
2020-02-17 10:54:32 +00:00
adamrk
0e260aa6b1
use 'if let' instead of match on kind in lower.rs
2020-02-17 11:53:12 +01:00
adamrk
68d3743faf
replace uses of VariantData::is_unit with VariantData::kind
2020-02-16 16:10:32 +01:00
Florian Diebold
e14e7ffa34
Fix coercion of &T to itself
...
The autoderef coercion logic did not handle matching placeholders. This led to
some type mismatches.
2020-02-16 12:58:20 +01:00
Florian Diebold
3484d727c3
Extend analysis-stats a bit
...
This adds some tools helpful when debugging nondeterminism in analysis-stats:
- a `--randomize` option that analyses everything in random order
- a `-vv` option that prints even more detail
Also add a debug log if Chalk fuel is exhausted (which would be a source of
nondeterminism, but didn't happen in my tests).
I found one source of nondeterminism (rust-lang/chalk#331 ), but there are still
other cases remaining.
2020-02-15 18:04:01 +01:00
bors[bot]
b2b94cbf71
Merge #3147
...
3147: Check that impl self type matches up with expected self type in path mode r=matklad a=flodiebold
Fixes #3144 .
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-02-14 20:32:55 +00:00
Florian Diebold
f47dc4de8d
Check that impl self type matches up with expected self type in path mode
...
Fixes #3144 .
2020-02-14 21:08:25 +01:00
Florian Diebold
001dd6a200
Make Self implement the trait inside trait default methods
2020-02-14 20:39:04 +01:00
Florian Diebold
5028b86cb8
Move hir_fmt code to display module
2020-02-14 15:01:42 +01:00
Florian Diebold
a324d066cb
Rename Ty::Param => Ty::Placeholder
...
This aligns more with Chalk.
2020-02-14 14:44:00 +01:00
Florian Diebold
43df7c3d53
Don't let unknown match arms fall back to !
2020-02-11 21:09:11 +01:00
Matthew Jasper
8c8d0bb34f
Add or- and parenthesized-patterns
2020-02-09 22:06:15 +00:00
Florian Diebold
eefe02ce6e
Add two more tests
2020-02-07 18:28:11 +01:00
Florian Diebold
9d6061f3bb
Fix some TODOs
2020-02-07 18:28:11 +01:00
Florian Diebold
b0bb8622ee
Don't print implicit type args from impl Trait
2020-02-07 18:28:11 +01:00
Florian Diebold
6c70619b01
Deal better with implicit type parameters and argument lists
2020-02-07 18:28:10 +01:00
Florian Diebold
dded90a748
Formatting
2020-02-07 18:28:10 +01:00
Florian Diebold
6787f124b5
Clean up RPIT a bit
2020-02-07 18:28:10 +01:00
Florian Diebold
0718682cff
Fix compilation of other crates
2020-02-07 18:28:10 +01:00
Florian Diebold
a3d8cffde3
Use variables in predicates as well
2020-02-07 18:28:10 +01:00
Florian Diebold
86348f5994
Comment fixes / todos
2020-02-07 18:28:10 +01:00
Florian Diebold
3397ca679f
Fix APIT some more
2020-02-07 18:28:10 +01:00
Florian Diebold
c6654fd4a7
Fix APIT
2020-02-07 18:28:10 +01:00
Florian Diebold
ed25cf70d5
Change Ty::Param to contain param ID
2020-02-07 18:28:10 +01:00
Florian Diebold
f8b7b64bce
WIP use params for APIT
2020-02-07 18:28:10 +01:00
Florian Diebold
33aa2f8e4f
Fix assoc type selection
2020-02-07 18:28:10 +01:00
Florian Diebold
4a8279a21a
Fix another test
2020-02-07 18:28:10 +01:00
Florian Diebold
dbc14f9d57
First stab at desugaring bounds for APIT
2020-02-07 18:28:10 +01:00
Florian Diebold
a9430865b3
Fix crash
2020-02-07 18:28:10 +01:00
Florian Diebold
a5554dcb17
Fix enum constructors
2020-02-07 18:28:10 +01:00
Florian Diebold
4789a993eb
Fix printing of function types
2020-02-07 18:28:10 +01:00
Florian Diebold
16c6937447
Lower impl trait to variables, move away from using placeholders where they don't belong
2020-02-07 18:28:10 +01:00
Florian Diebold
93aa166748
wip lower impl trait to type args
2020-02-07 18:28:10 +01:00
Florian Diebold
9dec65d3b1
wip implement lowering mode
2020-02-07 18:28:10 +01:00
Florian Diebold
7ea4bce1b2
Add impl trait lowering mode
2020-02-07 18:28:10 +01:00
Florian Diebold
22a65b11b3
Introduce TyLoweringContext
2020-02-07 18:28:10 +01:00
Aleksey Kladov
6ca19b2188
Standard formatting for array types
2020-01-28 15:32:20 +01:00
Florian Diebold
339a11c33c
Tweak Chalk settings
2020-01-27 21:52:35 +01:00
Florian Diebold
d3a3e5abdf
Ignore failing impl Trait tests
2020-01-27 21:38:10 +01:00
Florian Diebold
96ddf2962c
Upgrade Chalk
2020-01-27 21:25:33 +01:00
Jeremy Kolb
b89991daed
Update crates
2020-01-26 10:46:45 -05:00
Kirill Bulatov
4029e44102
Omit default parameters for reference types
2020-01-22 16:55:09 +02:00
Florian Diebold
33d637f2dd
Fix inference for shift operators
...
Fixes #2602 .
2020-01-17 16:59:51 +01:00
bors[bot]
767ff2c13c
Merge #2844
...
2844: Use dummy value for line! and column! macro r=matklad a=edwin0cheng
Use dummy value `0` for line! and column! macro.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-14 17:59:24 +00:00
Edwin Cheng
6ebb1edf21
Use dummy value for line! and column! macro
2020-01-15 01:47:01 +08:00
Aleksey Kladov
21c5fd8b1b
Push resolver further up
2020-01-14 14:24:03 +01:00
Aleksey Kladov
7ec62ea5e6
Push resolver up
2020-01-14 14:11:07 +01:00
Aleksey Kladov
52e7f67128
Move impls_future to Type, where it belongs
2020-01-14 11:29:43 +01:00
Aleksey Kladov
5654387e77
Don't panic if chalk panics
2020-01-13 19:00:42 +01:00
Florian Diebold
9dc1826cfa
Fix various names, e.g. Iterator not resolving in core prelude
...
Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.
Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.
Fixes #2683 .
2020-01-11 23:37:58 +01:00
Florian Diebold
dd6ec81d65
Add test for macro expansion in various expressions
2020-01-10 22:08:02 +01:00
Edwin Cheng
ca62d98781
Expand PAREN_EXPR as expression
2020-01-11 00:29:00 +08:00
bors[bot]
cb160f2a34
Merge #2742
...
2742: Split `infer` query into two for better profiling r=flodiebold a=michalt
This is the same change as we did with `crate_def_map` and it does seem
that we mostly spend time in salsa, without recomputing much on
rust-analyzer side.
Example output:
```
233ms - handle_inlay_hints
163ms - get_inlay_hints
163ms - SourceAnalyzer::new
67ms - def_with_body_from_child_node
67ms - analyze_container
67ms - analyze_container
67ms - Module::from_definition
67ms - Module::from_file
67ms - crate_def_map
0ms - parse_macro_query (6 calls)
0ms - raw_items_query (1 calls)
66ms - ???
0ms - crate_def_map (1 calls)
0ms - crate_def_map (1 calls)
96ms - infer
2ms - trait_solve_query (2 calls)
94ms - ???
0ms - body_with_source_map_query (1 calls)
0ms - crate_def_map (1 calls)
[...]
```
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Co-authored-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 19:08:32 +00:00
Michal Terepeta
d6c2a59538
Split infer
query into two for better profiling
...
This is the same change as we did with `crate_def_map` and it does seem
that we mostly spend time in salsa, without recomputing much on
rust-analyzer side.
Example output:
```
233ms - handle_inlay_hints
163ms - get_inlay_hints
163ms - SourceAnalyzer::new
67ms - def_with_body_from_child_node
67ms - analyze_container
67ms - analyze_container
67ms - Module::from_definition
67ms - Module::from_file
67ms - crate_def_map
0ms - parse_macro_query (6 calls)
0ms - raw_items_query (1 calls)
66ms - ???
0ms - crate_def_map (1 calls)
0ms - crate_def_map (1 calls)
96ms - infer
2ms - trait_solve_query (2 calls)
94ms - ???
0ms - body_with_source_map_query (1 calls)
0ms - crate_def_map (1 calls)
[...]
```
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 19:58:11 +01:00
Florian Diebold
67240c8d91
Fix #2705
...
The `-` turned into a `+` during a refactoring.
The original issue was caused by `Read` resolving wrongly to a trait without
type parameters instead of a struct with one parameter; this only fixes the
crash, not the wrong resolution.
2020-01-03 14:57:11 +01:00
Emil Lauridsen
8fad8e897a
Resolve traits in infer using lang item infrastructure
2019-12-29 17:39:31 +01:00
Aleksey Kladov
8f36f768e1
Don't add non-impl/trait containers to scope
2019-12-29 14:47:47 +01:00
bors[bot]
823e9193fe
Merge #2657
...
2657: Omit closure parameters in closure type display strings r=flodiebold a=SomeoneToIgnore
Part of https://github.com/rust-analyzer/rust-analyzer/issues/1946
I wonder, should we display the the closure trait (Fn/FnMut/FnOnce) in inlay hints instead of `|...|` at all?
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-12-27 10:10:07 +00:00
bors[bot]
3f7e5cde0b
Merge #2661
...
2661: Implement infer await from async function r=flodiebold a=edwin0cheng
This PR is my attempt for trying to add support for infer `.await` expression from an `async` function, by desugaring its return type to `Impl Future<Output=RetType>`.
Note that I don't know it is supposed to desugaring it in that phase, if it is not suitable in current design, just feel free to reject it :)
r=@flodiebold
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-24 16:28:46 +00:00
Edwin Cheng
42813126d9
Check if parameters is empty
2019-12-25 00:12:29 +08:00
Edwin Cheng
3a2cf708ed
Add FIXME
2019-12-24 23:39:17 +08:00
Edwin Cheng
0edb5b4a50
Implement infer await from async func
2019-12-24 19:45:28 +08:00
Kirill Bulatov
242be3631e
Omit closure parameters
2019-12-23 18:30:25 +02:00
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
bors[bot]
f18b7e18c4
Merge #2484
...
2484: DynMap r=matklad a=matklad
Implement a `DynMap` a semi-dynamic, semi-static map, which helps to thread heterogeneously typed info in a uniform way. Totally inspired by df3bee3038/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java
.
@flodiebold wdyt? Seems like a potentially useful pattern for various source-map-like things.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-06 20:28:28 +00:00
Aleksey Kladov
8c86963d47
DynMap
...
This might, or might not help us to reduce boilerplate associated with
plumbing values from analysis to the IDE layer
2019-12-06 21:28:05 +01:00
Edwin Cheng
76ff5b7c15
Add tests
2019-12-06 23:48:45 +08:00
Florian Diebold
f86fe3d891
Don't unify within a reference
...
If we are expecting a `&Foo` and get a `&something`, when checking the
`something`, we are *expecting* a `Foo`, but we shouldn't try to unify whatever
we get with that expectation, because it could actually be a `&Foo`, and `&&Foo`
coerces to `&Foo`. So this fixes quite a few false type mismatches.
2019-12-06 15:15:26 +01:00
Aleksey Kladov
b84ce79f91
Simplify test
2019-12-05 21:17:17 +01:00
Florian Diebold
db8a00bd99
Implement derive(Copy, Clone) properly (well, kind of)
2019-12-05 19:29:57 +01:00
ice1000
7cbedc50bc
Fix test compilation
2019-12-04 18:30:42 -05:00
Florian Diebold
9747156f6c
Split up ty tests a bit
2019-12-03 18:00:29 +01:00
ice1000
009437f5d9
Replace ra_hir_expand::either
with crate
2019-12-03 11:07:56 -05:00
Florian Diebold
e4add45951
Fix #2467
...
The stand-alone `unify` requires that the type doesn't contain any type
variables. So we can't share the code here for now (without more refactoring)...
2019-12-03 15:01:23 +01:00
bors[bot]
ba4f7fa02f
Merge #2465
...
2465: Extract built-in trait implementations to separate module r=matklad a=flodiebold
This untangles the builtin logic from the Chalk translation.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-03 13:43:05 +00:00
Florian Diebold
18f25acb89
Make unify pub(crate)
2019-12-03 13:58:02 +01:00
Florian Diebold
176207f1e8
Extract built-in trait implementations to separate module
...
This untangles the builtin logic from the Chalk translation.
2019-12-03 12:30:50 +01:00
Florian Diebold
a5a07bde04
Add tests for checking the impl self type
2019-12-02 19:33:13 +01:00
Florian Diebold
cfa50df33e
Refactor a bit
2019-12-02 19:33:13 +01:00
Florian Diebold
456d52fdfa
Check receiver type properly
2019-12-02 19:33:13 +01:00
Florian Diebold
599dab5982
Extract unification code to unify module
2019-12-02 19:33:13 +01:00
Florian Diebold
cbf262a1bc
Change order of calls to get method candidate order correct
2019-12-02 19:33:13 +01:00
bors[bot]
ec164fbb68
Merge #2455
...
2455: Add BuiltinShadowMode r=flodiebold a=edwin0cheng
This PR try to fix #1905 by introduce an `BuiltinShadowMode` in name resolving functions.
cc @flodiebold
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-01 11:13:25 +00:00
Edwin Cheng
bb601e7eaf
Add BuiltinShadowMode
2019-11-30 23:29:21 +08:00
Florian Diebold
1c622e9fed
Add cycle recovery for type aliases
2019-11-30 12:57:32 +01:00
Florian Diebold
3ca40f7c08
Add cycle recovery for generic predicates
2019-11-30 12:57:32 +01:00
Florian Diebold
cf6809645e
Handle cycles in impl types better
...
- impl Trait<Self> for S is allowed
- impl Trait for S<Self> is an invalid cycle, but we can add cycle recovery for
it in Salsa now
2019-11-30 12:57:32 +01:00
oxalica
2cb684bbce
Reduce variants of Expr
2019-11-29 14:49:12 +08:00
oxalica
4992d2bf79
Infer range types
2019-11-29 03:10:16 +08:00
Aleksey Kladov
8f1f5a783a
Move source-related traits to a separate module
2019-11-28 19:05:21 +03:00
Aleksey Kladov
ccd1b0800a
Rename Source -> InFile
2019-11-28 12:50:26 +03:00
Aleksey Kladov
1d14fd1737
Use Name::missing consistently
2019-11-27 23:22:20 +03:00
Aleksey Kladov
04735abfae
Minimize API
2019-11-27 22:21:01 +03:00
Aleksey Kladov
8d34696826
Memoize impl resolutions
2019-11-27 22:12:09 +03:00
Aleksey Kladov
d9a36a736b
Rename module_id -> local_id
2019-11-27 21:31:51 +03:00
Aleksey Kladov
47ec2ceb12
prune deps
2019-11-27 21:26:49 +03:00
Aleksey Kladov
a87579500a
Move Ty
2019-11-27 21:16:00 +03:00
Jeremy Kolb
b81548c73a
Fix stale crates that snuck in
2019-11-26 08:20:40 -05:00
Aleksey Kladov
4e17718a9a
Doc primitives
2019-11-26 15:41:48 +03:00
Aleksey Kladov
4c43631829
Introduce hir_ty
2019-11-26 15:06:06 +03:00