Commit Graph

470 Commits

Author SHA1 Message Date
Florian Diebold
d885f38011 Remove some unnecessary file names 2020-07-12 20:20:31 +02:00
Florian Diebold
c6f53aaaa4 Add test for #4281
Fixes #4281.
2020-07-12 20:20:31 +02:00
Florian Diebold
7e9c4d58f1 Search more efficiently for int/float impls 2020-07-12 20:20:31 +02:00
Florian Diebold
00bda1cafb Adapt trait object coercion tests to the status quo 2020-07-12 20:20:31 +02:00
Florian Diebold
94f5f69ff4 Use Chalk built-in representation for array types 2020-07-12 20:20:31 +02:00
Florian Diebold
2a4166501d Remove built-in Unsize impls
They exist in Chalk now.
2020-07-12 20:20:31 +02:00
Florian Diebold
71d645101d Upgrade Chalk 2020-07-12 20:20:31 +02:00
Florian Diebold
c82f5379de Enable Chalk tracing in hir_ty tests 2020-07-12 20:12:01 +02:00
Florian Diebold
209c492432 Upgrade Chalk 2020-07-12 19:58:34 +02:00
Otavio Salvador
9d114b9707 infer: Add type inference support for Union types
This adds the type inference to Union types and add a small test case
for it, ensuring it keeps working in future.

Fixes: #5277
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2020-07-11 19:30:02 -03:00
Jonas Schievink
74aa0ab9f7 arg count mismatch: handle tuple ctors 2020-07-09 18:24:02 +02:00
Jonas Schievink
f4a9d9a00f Address review comments 2020-07-09 17:33:49 +02:00
Jonas Schievink
984b6889eb Add tests 2020-07-09 15:52:10 +02:00
Jonas Schievink
3ce4407dcb Fix diagnostic for method calls 2020-07-09 15:51:32 +02:00
Jonas Schievink
d04f3604d5 Correctly pluralize message 2020-07-09 15:50:53 +02:00
Jonas Schievink
47d0cf201c Don't emit diagnostic if there are type errors 2020-07-09 12:41:35 +02:00
Jonas Schievink
63ce2c7b5f Add argument count mismatch diagnostic 2020-07-09 12:16:29 +02:00
bors[bot]
0f5d62a3f3
Merge #5235 #5236 #5241
5235: Don't ping people in PRs r=matklad a=lnicola



5236: Disable ES module interop r=matklad a=lnicola



5241: Clippy perf warnings r=matklad a=kjeremy

Removes redundant clones

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-07 09:29:52 +00:00
Aleksey Kladov
4bbc385277 Switch to fully dynamically dispatched salsa
This improves compile times quite a bit
2020-07-07 10:14:48 +02:00
kjeremy
ebdee366b0 Clippy perf warnings
Removes redundant clones
2020-07-06 17:13:55 -04:00
Florian Diebold
57feb323f7 Fix inference of indexing argument (partly)
We need to add the `T: Index<Arg>` obligation to be resolved later as well,
otherwise we can't make inferences about `Arg` later based on the `Index` impls.

This still doesn't fix indexing with integer variables though; there's a further
problem with Chalk floundering because of the variable, I think.
2020-07-03 18:17:06 +02:00
bors[bot]
a33eefa3b2
Merge #5149
5149: Implement Chalk variable kinds r=flodiebold a=flodiebold

This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.)

Should fix the last remaining issue of #2534.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-07-01 18:41:06 +00:00
Florian Diebold
d5d485ef92 Implement Chalk variable kinds
This means we need to keep track of the kinds (general/int/float) of variables
in `Canonical`, which requires some more ceremony. (It also exposes some places
where we're not really dealing with canonicalization correctly -- another thing
to be cleaned up when we switch to using Chalk's types directly.)

Should fix the last remaining issue of #2534.
2020-07-01 20:40:38 +02:00
Jonas Schievink
4ef1d533bd ItemTree: Lower fields despite invalid type 2020-07-01 19:24:39 +02:00
Jonas Schievink
6bde542a39 Split CrateImplDefs in inherent and trait impls
This makes the intention of inherent vs. trait impls somewhat more
clear and also fixes (?) an issue where trait impls with an unresolved
trait were added as inherent impls instead (hence the test changes).
2020-07-01 17:15:20 +02:00
Jonas Schievink
07ba986db7 Don't recursively call impls_from_deps
It creates a big map and duplicates lots of impls that are then left
lying around
2020-07-01 15:19:36 +02:00
Laurențiu Nicola
1be5e848b0 Use dynamic dispatch in AstDiagnostic 2020-07-01 10:46:27 +03:00
Aleksey Kladov
d34e725f09 Better factoring 2020-06-30 12:14:16 +02:00
Aleksey Kladov
bbc4dc9956 Update the rest of the tests 2020-06-29 17:23:01 +02:00
Aleksey Kladov
e805e8c1d5 (T): make typification tests more data driven 2020-06-29 17:23:01 +02:00
bors[bot]
82ce5792ab
Merge #5124
5124: (Partially) fix handling of type params depending on type params r=matklad a=flodiebold

If the first type parameter gets inferred, that's still not handled correctly; it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before the `_` is instantiated into a type variable -- so afterwards, we have two type variables without any connection to each other.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-06-29 14:13:41 +00:00
Florian Diebold
8e8d2ffecb (Partially) fix handling of type params depending on type params
If the first type parameter gets inferred, that's still not handled correctly;
it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and
then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before
the `_` is instantiated into a type variable -- so afterwards, we have two type
variables without any connection to each other.
2020-06-29 16:10:20 +02:00
bors[bot]
ca31b1d63a
Merge #5105
5105: Simlify with matches!() r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-28 22:37:25 +00:00
Florian Diebold
3fe0d73670 Update Chalk to released version 2020-06-28 21:24:20 +02:00
Veetaha
e75e2ae5b6 Simlify with matches!() 2020-06-28 04:03:59 +03:00
Paul Daniel Faria
68a649d547 Simplify unsafe expr collection match 2020-06-27 12:00:46 -04:00
Paul Daniel Faria
b7e25ba854 Improve perf of finding unsafe exprs 2020-06-27 11:55:54 -04:00
Paul Daniel Faria
b1992b469c Remove unneeded code, filename from tests, fix rebasing issues 2020-06-27 11:38:34 -04:00
Paul Daniel Faria
2fc92fa28c Remove track_parent and parent_map, replace with simple walk in missign unsafe validator 2020-06-27 10:13:14 -04:00
Paul Daniel Faria
2608a6fd3a unsafe: Clean up, improve tracking, add debug_assert
Move unsafe_expressions to unsafe_validation.rs, replace vec tracking of
child exprs with inline macro, add debug assert to ensure tracked
children match walked children exactly
2020-06-27 10:13:14 -04:00
Paul Daniel Faria
f678e0d837 Add HighlightTag::Operator, use it for unsafe deref. Move unsafe validation to its own file 2020-06-27 10:13:14 -04:00
Paul Daniel Faria
7f2219dc76 Track expr parents during lowering, use parent map when checking if unsafe exprs are within unsafe blocks 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
9ce44be2ab Address review comments, have MissingUnsafe diagnostic point to each unsafe use, update tests 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
b9569886a9 Rename Expr::UnsafeBlock to Expr::Unsafe 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
278cbf12cd Track unsafe blocks, don't trigger missing unsafe diagnostic when unsafe exprs within unsafe block 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
3df0f9ce7e Add missing self param to test 2020-06-27 10:09:42 -04:00
Paul Daniel Faria
499d4c454d Remove UnnecessaryUnsafe diagnostic, Fix Expr::Call unsafe analysis 2020-06-27 10:09:42 -04:00
Paul Daniel Faria
b358fbfdf8 Add tests covering unsafe blocks, more attempts to get call expr tests passing 2020-06-27 10:09:29 -04:00
Paul Daniel Faria
daf1cac9f8 Move diagnostics back into expr, add tests for diagnostics, fix logic to account for derefs of raw ptrs 2020-06-27 10:09:29 -04:00
Paul Daniel Faria
0b95bed83f Add unsafe diagnostics and unsafe highlighting 2020-06-27 10:08:14 -04:00