Commit graph

385 commits

Author SHA1 Message Date
Jonas Schievink
d8af7983b1 Use ra_fixture and reformat tests 2020-06-16 22:54:41 +02:00
Jonas Schievink
9ecbadcedb Fix index-out-of-bounds panic in match checking 2020-06-16 22:45:34 +02:00
Jonas Schievink
4ebafb9005 _match.rs: improve comment formatting 2020-06-14 15:56:02 +02:00
Jonas Schievink
90331ea035 Make known paths use core instead of std 2020-06-11 16:23:20 +02:00
Aleksey Kladov
d8a5d39c2d Make relevant_crates return a Set 2020-06-11 11:30:06 +02:00
Florian Diebold
d66daee849 Clean up handling of int/float literal types
'Unknown' int/float types actually never exist as such, they get replaced by
type variables immediately. So the whole `Uncertain<IntTy>` thing was
unnecessary and just led to a bunch of match branches that were never hit.
2020-06-06 17:52:00 +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
bors[bot]
02f7b5d7ab
Merge #4761
4761: Upgrade Chalk to published version r=matklad a=flodiebold

CC @pksunkara 

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-05 16:05:06 +00:00
bors[bot]
2a3ab7f3b4
Merge #4689
4689: Implement return position impl trait / opaque type support r=matklad a=flodiebold

This is working, but I'm not that happy with how the lowering works. We might need an additional representation between `TypeRef` and `Ty` where names are resolved and `impl Trait` bounds are separated out, but things like inference variables don't exist and `impl Trait` is always represented the same way.

Also note that this doesn't implement correct handling of RPIT *inside* the function (which involves turning the `impl Trait`s into variables and creating obligations for them). That intermediate representation might help there as well.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-05 15:46:28 +00:00
Florian Diebold
0d2328f3ea Review fixes 2020-06-05 17:41:58 +02:00
Aleksey Kladov
bbb40d7463 Minimize FileLoader interface 2020-06-05 17:22:56 +02:00
Florian Diebold
02962b374e Implement return position impl trait / opaque type support
This is working, but I'm not that happy with how the lowering works. We might
need an additional representation between `TypeRef` and `Ty` where names are
resolved and `impl Trait` bounds are separated out, but things like inference
variables don't exist and `impl Trait` is always represented the same
way.

Also note that this doesn't implement correct handling of RPIT *inside* the
function (which involves turning the `impl Trait`s into variables and creating
obligations for them). That intermediate representation might help there as
well.
2020-06-05 17:08:27 +02:00
Florian Diebold
69854f7795 Upgrade Chalk to published version 2020-06-05 17:06:07 +02:00
Aleksey Kladov
bba374bab2 More direct signature for resolve_path 2020-06-05 15:07:30 +02:00
Aleksey Kladov
e63c00f100 Rename resolve_relative_path -> resolve_path
For things like `concant!(env!("OUT_DIR"))`, we need to support abs paths
2020-06-05 14:58:30 +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]
11f74f2827
Merge #4653
4653: Fix match ergonomics in closure parameters r=matklad a=flodiebold

Fixes #4476.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-05-30 07:52:07 +00: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
bors[bot]
3689c8c3f6
Merge #4652
4652: Upgrade Chalk r=kjeremy a=flodiebold

Fixes #4072.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-05-29 19:33:52 +00:00
Florian Diebold
6f67a46a6a Fix match ergonomics in closure parameters
Fixes #4476.
2020-05-29 17:36:43 +02:00
Florian Diebold
ab28f6c249 Upgrade Chalk
Fixes #4072.
2020-05-29 16:49:52 +02: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
bors[bot]
fc29d0e924
Merge #4641
4641: Upgrade Chalk r=matklad a=flodiebold

Chalk newly added TypeName::Never and Array; I implemented the conversion for
Never, but not Array since that expects a const argument.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-05-28 09:34:33 +00:00
Florian Diebold
c8a4bb1445 Upgrade Chalk
Chalk newly added TypeName::Never and Array; I implemented the conversion for
Never, but not Array since that expects a const argument.
2020-05-27 21:07:08 +02:00
Cadu
c011f04f55 Fixed missing newline on each field on "Missing structure fields". 2020-05-27 13:15:19 -03:00
Jeremy Kolb
a5cc9a8a9b Fix some clippy perf warnings 2020-05-25 13:35:52 -04:00
Florian Diebold
194dd9eb0d Use Chalk's Ty::Function for function pointer types
Function pointers can be 'higher-ranked' over lifetimes, which is why they're
not an application type in Chalk, but since we don't model lifetimes it doesn't
matter for us yet.
2020-05-22 21:05:28 +02:00
Florian Diebold
bfbc210bc1 Use Chalk's built-in representation of function item types 2020-05-22 21:05:13 +02:00
Florian Diebold
ea265aad64 Provide missing Chalk debug methods 2020-05-22 19:52:06 +02:00
Florian Diebold
27fe68ad5c Use TypeCtorId as AdtId directly, and rename the type alias StructId -> AdtId 2020-05-22 19:52:06 +02:00
Florian Diebold
1d0e27254d Split up chalk module a bit 2020-05-22 19:52:06 +02:00
Florian Diebold
e0f978018a Add some tests for Chalk built-in trait impls 2020-05-22 18:52:07 +02:00
Florian Diebold
02c2beaa8c Provide Chalk well-known traits 2020-05-22 17:32:49 +02:00
Florian Diebold
e81c76a95a Use Chalk's built-in representations of primitive types
For references, we make sure Chalk actually gets a lifetime here.
2020-05-22 17:32:49 +02:00
Florian Diebold
06ed140fc7 Update Chalk
As always, this just makes compilation work, we don't use the newly available
functionality yet.
2020-05-22 16:40:42 +02:00
Aleksey Kladov
ecac5d7de2 Switch to new magic marks 2020-05-20 13:02:53 +02:00
Roland Ruckerbauer
45021cae55 Apply suggestion of @flodiebold: Get rid of multiple unwraps 2020-05-19 22:53:19 +02:00
Roland Ruckerbauer
da09f96746 loop return value inference: add tests 2020-05-19 21:52:43 +02:00
Roland Ruckerbauer
6e36ad3d91 Move false negative expr_diverges_missing_arm() to working tests 2020-05-19 21:18:43 +02:00
Roland Ruckerbauer
6eaa669da0 loop return value inference: coerce_merge branches 2020-05-19 21:06:47 +02:00
Roland Ruckerbauer
0fe876925e Infer return type of loops with value breaks. 2020-05-18 23:39:10 +02:00
bors[bot]
9bdedbbcaf
Merge #4497
4497: Create LowerCtx on the fly r=matklad a=edwin0cheng

Previously we create `LowerCtx` at the beginning of lowering, however, the hygiene content is in fact changing between macro expression expanding. 

This PR change it to create the `LowerCtx` on the fly to fix above bug.

However, #4465 is not fixed by this PR, the goto-def is still not work yet. It only fixed the infer part. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-18 11:03:44 +00:00
Hrvoje Ban
68db49c853 Add more tests for Fn traits 2020-05-18 08:07:31 +02:00
Edwin Cheng
12a3bf3c31 Create LowerCtx on the fly 2020-05-17 23:37:30 +08:00
Florian Diebold
811d25b723 Allow calling dyn trait super trait methods without the super trait in scope
This also removes some vestiges of the old impl trait support which I think
aren't currently in use.
2020-05-16 18:37:05 +02:00
Florian Diebold
050601ef7b Chalk upgrade 2020-05-16 11:43:48 +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
Fedor Sakharov
12bf008ab1
Adds a param_idx helper 2020-05-14 13:47:36 +03:00