Commit Graph

576 Commits

Author SHA1 Message Date
Dawer
7d675eda80 Don't panic on a pattern of unresolved ADT variant. 2021-06-01 00:08:43 +05:00
Dawer
466345ca81 Clean up, more docs. 2021-06-01 00:08:27 +05:00
Dawer
49e016169f Check pattern types. 2021-06-01 00:03:47 +05:00
Dawer
9b841a9a04 Expand binding patterns. 2021-06-01 00:03:47 +05:00
Dawer
d7239e5ab4 Fix visibility warnings 2021-06-01 00:03:47 +05:00
Dawer
a236bfa57a Lower binding pattern 2021-06-01 00:03:47 +05:00
Dawer
cf6f989a8d Lower bool literals 2021-06-01 00:03:47 +05:00
Dawer
d6d77e8a35 Treat ctor of unhandled type as non-exhaustive. 2021-06-01 00:03:47 +05:00
Dawer
e711abc290 Lower Pat::Path 2021-06-01 00:03:47 +05:00
Dawer
e50ce67631 Do not do match check if lowering failed. 2021-06-01 00:03:47 +05:00
Dawer
de6f430140 Fix panics on pattern_arena.borrow with ugly cloning 2021-06-01 00:03:46 +05:00
Dawer
975109051c Basic lowering hir_def::exrp::Pat -> typed HIR.
Pattern arena is broken
2021-06-01 00:03:46 +05:00
Dawer
2431ff5987 Handle unordered fields in struct patterns 2021-06-01 00:03:46 +05:00
Dawer
3ffcb2658c Complete field replacing 2021-06-01 00:03:46 +05:00
Dawer
3a85e47f6a Support bool literal patterns 2021-06-01 00:03:46 +05:00
Dawer
5a8a0b6269 Check enum patterns 2021-06-01 00:03:46 +05:00
Dawer
b4f4197332 Build wildcard witnesses instead of panicking 2021-06-01 00:03:46 +05:00
Dawer
678d85ca7e Implement struct ctor application 2021-06-01 00:03:46 +05:00
Dawer
062c7953a1 Add remaining Constructor variants 2021-06-01 00:03:46 +05:00
Dawer
2880fd2320 Complete usefulness::SubPatSet impl 2021-06-01 00:03:46 +05:00
Dawer
f4c3960364 List useless patterns in a useful match arm 2021-06-01 00:03:45 +05:00
Dawer
f4a95c93fe Remove unneeded indirection on PatCtxt 2021-06-01 00:03:45 +05:00
Dawer
26baab5d28 Enable generation of non-exhaustiveness witnesses 2021-06-01 00:03:45 +05:00
Dawer
c3c2893f30 Update match checking.
fn is_useful , more skeletons

Specify a lifetime on pattern references

impl PatStack

fill impl Matrix

PatStack::pop_head_constructor

Index-based approach

struct PatCtxt

fields construction fn Fields::wildcards

split wildcard

fn Constructor::is_covered_by_any(..)

fn Matrix::specialize_constructor(..)

impl Usefulness

Initial work on witness construction

Reorganize files

Replace match checking diagnostic

Handle types of expanded patterns

unit match checking go brrr
2021-06-01 00:03:45 +05:00
Aleksey Kladov
159922de93 minor: it's Parameter, not Argument 2021-05-31 19:45:50 +03:00
Aleksey Kladov
341f8bb200 fix: avoid panics in match case diagnostic 2021-05-31 19:45:50 +03:00
bors[bot]
e9a797748d
Merge #8866
8866: Update salsa r=matklad a=jonas-schievink

This updates salsa to include https://github.com/salsa-rs/salsa/pull/265, and removes all cancellation-related code from rust-analyzer

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-31 12:42:32 +00:00
cynecx
51cbcc5346 hir_ty: don't pass where clauses of associated types down to chalk (temp. fix #9052) 2021-05-30 19:21:08 +02:00
bors[bot]
f41b68637a
Merge #9062
9062: internal: Bump deps r=lnicola a=lnicola

Fixes #9061

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-05-30 11:48:59 +00:00
Laurențiu Nicola
36567eb9be Bump deps 2021-05-30 14:48:10 +03:00
cynecx
54d60fdee9 hir_ty: use async ret type for inference inside async bodies 2021-05-29 18:17:45 +02:00
Jonas Schievink
31588aea04 Remove fragment kind knowledge from builtin macros 2021-05-29 17:17:08 +02:00
Jonas Schievink
26b4777e1f Move hir_ty incremental test to its own file 2021-05-27 20:21:52 +02:00
Jonas Schievink
33debc4065 Update salsa 2021-05-27 15:05:41 +02:00
bors[bot]
f3aaae6555
Merge #9007
9007: Internal: `clippy::redundant_clone` fixes r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-05-26 15:36:14 +00:00
Laurențiu Nicola
8206939fed clippy::redundant_clone fixes 2021-05-26 18:34:50 +03:00
bors[bot]
5587d0a3e3
Merge #8973
8973: internal: move diagnostics to hir r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-25 20:33:21 +00:00
Aleksey Kladov
5c9f31d4c2 internal: move diagnostics to hir
The idea here is to eventually get rid of `dyn Diagnostic` and
`DiagnosticSink` infrastructure altogether, and just have a `enum
hir::Diagnostic` instead.

The problem with `dyn Diagnostic` is that it is defined in the lowest
level of the stack (hir_expand), but is used by the highest level (ide).

As a first step, we free hir_expand and hir_def from `dyn Diagnostic`
and kick the can up to `hir_ty`, as an intermediate state. The plan is
then to move DiagnosticSink similarly to the hir crate, and, as final
third step, remove its usage from the ide.

One currently unsolved problem is testing. You can notice that the test
which checks precise diagnostic ranges, unresolved_import_in_use_tree,
was moved to the ide layer. Logically, only IDE should have the infra to
render a specific range.

At the same time, the range is determined with the data produced in
hir_def and hir crates, so this layering is rather unfortunate. Working
on hir_def shouldn't require compiling `ide` for testing.
2021-05-25 17:49:59 +03:00
Lukas Wirth
28ca371755 Consider trait to be in scope for trait-impl 2021-05-25 16:16:29 +02:00
bors[bot]
33fdd512e3
Merge #8987
8987: Fix lowering of FnOnce() without return type r=flodiebold a=flodiebold

This should result in an implicit `-> ()`, not leaving out the binding.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-05-25 13:25:15 +00:00
Florian Diebold
7c6f764ad6 Hide -> () in Fn traits 2021-05-25 15:23:52 +02:00
Lukas Wirth
3ee4e6c54c Fix type inference not working for new Try trait 2021-05-25 14:59:54 +02:00
Florian Diebold
35c948ff4a Fix lowering of FnOnce() without return type
This should result in an implicit `-> ()`, not leaving out the binding.
2021-05-25 14:29:53 +02:00
Florian Diebold
c33ee36d2a Minor test fixes / new tests 2021-05-25 13:07:18 +02:00
Florian Diebold
b26a472ccb Fix type mismatch caused by macros
MacroStmts should be completely transparent, but it prevented
coercion. (I should maybe give `infer_expr` and `infer_expr_inner`
better names.)
2021-05-25 11:15:02 +02:00
Aleksey Kladov
45112aa8c0 internal: rename hypothetical -> speculative
Lets steal this good naming from Roslyn before I forget about it yet
again.
2021-05-24 22:21:25 +03:00
bors[bot]
c139eff5b8
Merge #8963
8963: Bump deps r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-05-24 15:34:52 +00:00
Laurențiu Nicola
74f1b21b08 Bump chalk 2021-05-24 16:27:24 +03:00
Jonas Schievink
8ebb8d29e1 internal: intern TypeBounds
Doesn't save much memory (~2 mb), but interning things is generally a
good pattern to follow
2021-05-24 15:13:23 +02:00
Florian Diebold
4a6cdd776d Record method call substs and use them in call info 2021-05-23 18:24:21 +02:00