Jonas Schievink
90331ea035
Make known paths use core
instead of std
2020-06-11 16:23:20 +02:00
Florian Diebold
a4a4a1854e
Fix type parameter defaults
...
They should not be applied in expression or pattern contexts, unless there are
other explicitly given type args.
2020-06-05 20:09:13 +02:00
robojumper
1cd78a3355
correctly infer labelled breaks
2020-05-31 11:40:18 +02:00
robojumper
fb469c3b31
labelled break test
2020-05-31 11:24:53 +02:00
bors[bot]
f7f01dd5f0
Merge #4651
...
4651: Use first match branch in case of type mismatch, not last r=kjeremy a=flodiebold
The comment says this was intentional, but I do agree with #4304 that it makes
more sense the other way around (for if/else as well).
Fixes #4304 .
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-05-29 21:07:43 +00:00
Florian Diebold
7d0586cb15
Use first match branch in case of type mismatch, not last
...
The comment says this was intentional, but I do agree with #4304 that it makes
more sense the other way around (for if/else as well).
Fixes #4304 .
2020-05-29 16:04:56 +02:00
robojumper
367487fe88
Support raw_ref_op's raw reference operator
2020-05-28 21:42:22 +02:00
Roland Ruckerbauer
da09f96746
loop return value inference: add tests
2020-05-19 21:52:43 +02:00
Florian Diebold
3f42b2e837
Handle Self
in values and patterns
...
I.e.
- `Self(x)` or `Self` in tuple/unit struct impls
- `Self::Variant(x)` or `Self::Variant` in enum impls
- the same in patterns
Fixes #4454 .
2020-05-15 17:25:28 +02:00
Emil Lauridsen
85d44cad45
infer: Make expected rhs type for plain assign the lhs type
...
This fixes an issue where the following code sample would fail to infer
the type contained in the option:
```rust
fn main() {
let mut end = None; // TODO: Fix inference for this in RA
loop {
end = Some(true);
}
}
```
2020-05-10 16:24:04 +02:00
Florian Diebold
fe7bf993aa
Implement better handling of divergence
...
Divergence here means that for some reason, the end of a block will not be
reached. We tried to model this just using the never type, but that doesn't work
fully (e.g. in `let x = { loop {}; "foo" };` x should still have type `&str`);
so this introduces a `diverges` flag that the type checker keeps track of, like
rustc does.
2020-05-08 18:15:24 +02:00
Florian Diebold
f5177f91ae
Fix type of byte literals
...
They're `&[u8; N]`, not `&[u8]` (see #4374 ).
2020-05-08 15:18:33 +02:00
Aleksey Kladov
b58dfd24f1
Add smoke test for decorated blocks
2020-05-02 11:27:28 +02:00
Aleksey Kladov
8843588fca
Convert tests to text-size
2020-04-25 11:59:18 +02:00
Laurențiu Nicola
7d62280a71
Hide unit fn return types
2020-04-05 21:06:47 +03:00
Laurențiu Nicola
b58a7f41f1
Fix inference of function pointer return types
2020-04-05 18:18:40 +03:00
Florian Diebold
b392a732d3
Add inference for literal and range patterns
2020-04-01 20:27:47 +02:00
Florian Diebold
073a1ef834
Support aliases and Self in struct literals
...
Fixes #3306 .
2020-03-06 15:43:14 +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
Aleksey Kladov
6ca19b2188
Standard formatting for array types
2020-01-28 15:32:20 +01:00
Florian Diebold
33d637f2dd
Fix inference for shift operators
...
Fixes #2602 .
2020-01-17 16:59:51 +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
Aleksey Kladov
e424545c0f
Rudimentary name resolution for local items
2019-12-22 22:41:21 +01:00
Florian Diebold
2a8c9100bf
Handle closure return types
...
Fixes #2547 .
2019-12-20 18:16:11 +01:00
Florian Diebold
9747156f6c
Split up ty tests a bit
2019-12-03 18:00:29 +01:00