Lukas Wirth
9272942b92
Use CoerceMany
in BreakableContext
2021-07-09 15:51:07 +02:00
Florian Diebold
d674d7185d
Represent opaque types with TyKind::OpaqueType
...
... instead of using `AliasTy`. Chalk turns the alias type into the
placeholder during unification anyway, which confuses our method
resolution logic.
Fixes #9530 .
2021-07-08 21:40:35 +02:00
Lukas Wirth
e968d834ca
Add some more adjustment test annotations
2021-07-08 15:03:57 +02:00
Lukas Wirth
349f2535fb
Copy some comments from rustc
2021-07-08 14:31:16 +02:00
Lukas Wirth
f73d0ee439
Minor cleanup
2021-07-08 14:27:54 +02:00
Lukas Wirth
64a1b26b8d
Implement CoerceMany
2021-07-08 14:16:23 +02:00
Lukas Wirth
9779526d8f
Record coercion adjustments
2021-07-08 13:07:24 +02:00
Laurențiu Nicola
3b2602cbb2
Don't unify array elements with their arrays
2021-07-08 12:55:00 +03:00
Jonas Schievink
cb63b021ff
Implement LUB coercion of array elements
2021-07-07 22:50:20 +02:00
Aleksey Kladov
86720f2953
minor: drop dummy authors field
2021-07-05 14:19:41 +03:00
bors[bot]
16871f6f93
Merge #9428
...
9428: fix: Fix deduction of `dyn Fn` closure parameter types r=flodiebold a=jonas-schievink
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-02 12:49:34 +00:00
Jonas Schievink
835d1cec59
Substitute self type instead of fusing binders
2021-07-02 00:16:36 +02:00
Jonas Schievink
cee9a7e26a
Bind the right number of variables in the FnPointer
2021-07-01 20:54:25 +02:00
Jonas Schievink
e6fdb38d38
Use as_tuple()
2021-07-01 20:45:47 +02:00
Jonas Schievink
b5a2289676
Remove unneeded shifted_in
2021-06-30 15:45:00 +02:00
Jonas Schievink
b502a10b1e
update comment
2021-06-30 15:13:59 +02:00
Jonas Schievink
88a86d4ff9
Fix deduction of dyn Fn
closure parameter types
2021-06-30 15:04:04 +02:00
Lukas Wirth
af739731db
Implement TypeRef::ForLifetime
2021-06-30 01:34:54 +02:00
Florian Diebold
a1120b6879
Fix benchmark_include_macro
2021-06-20 19:37:45 +02:00
Florian Diebold
78419779f1
More cleanups, use check
for display_source_code
tests
2021-06-20 19:12:06 +02:00
Florian Diebold
0219b145ea
Clean up coercion tests
2021-06-20 19:12:06 +02:00
Florian Diebold
04fbdce426
Unify check_mismatches and check_types
2021-06-20 19:12:06 +02:00
Florian Diebold
679bb21633
Add coverage mark for block local impls
2021-06-20 19:12:06 +02:00
Aleksey Kladov
89a0e58393
internal: use minicore deref more
2021-06-18 22:47:02 +03:00
Aleksey Kladov
991919e71f
internal: add index to minicore
2021-06-18 22:37:34 +03:00
Aleksey Kladov
73b3ee664e
minor: use minicore
2021-06-18 22:25:35 +03:00
Laurențiu Nicola
e3ce88f6f2
Minor clippy perf fixes
2021-06-18 14:40:51 +03:00
Lukas Wirth
95c8c65139
Nest all the or-patterns!
2021-06-17 17:37:14 +02:00
Aleksey Kladov
ee7b649d44
internal: switch some tests to minicore
2021-06-16 22:54:57 +03:00
Aleksey Kladov
604267088c
internal: add iterator to minicore
2021-06-16 22:48:48 +03:00
Aleksey Kladov
8a4d9bb80a
internal: add fn to minicore
2021-06-16 12:15:45 +03:00
Aleksey Kladov
0798cce9e5
internal: add result to minicore
2021-06-15 23:07:25 +03:00
Aleksey Kladov
2870d2bade
internal: add option to minicore
2021-06-15 22:59:51 +03:00
Aleksey Kladov
3efe5c3426
internal: add future to minicore
2021-06-15 22:49:00 +03:00
Aleksey Kladov
09c4013ec0
internal: switch some tests to minicore
2021-06-15 22:02:29 +03:00
Aleksey Kladov
ee13e895e3
internal: switch some tests to minicore
2021-06-15 21:57:56 +03:00
Aleksey Kladov
0bb1f1bc90
internal: add ranges to minicore
2021-06-15 21:45:25 +03:00
Aleksey Kladov
f4b52682da
internal: unindent some tests
2021-06-15 21:39:44 +03:00
Aleksey Kladov
b737b894cb
internal: switch some tests to minicore
2021-06-15 21:36:50 +03:00
Aleksey Kladov
7ebac5e54c
internal: switch some tests to minicore
2021-06-15 21:34:26 +03:00
Aleksey Kladov
0475201538
internal: switch some tests to minicore
2021-06-15 21:19:51 +03:00
Aleksey Kladov
f841369fee
internal: switch some tests to minicore
2021-06-15 21:11:53 +03:00
Aleksey Kladov
f521e41853
internal: introduce minicore -- a subset of libcore for testing
2021-06-15 21:03:08 +03:00
bors[bot]
fa4c851619
Merge #9278
...
9278: internal: document that we don't #[ignore] tests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 08:48:15 +00:00
Aleksey Kladov
3f4ad44082
internal: document that we don't #[ignore] tests
2021-06-15 11:46:47 +03:00
Aleksey Kladov
06f5d6f640
internal: don't pull tracing via chalk
2021-06-14 20:41:08 +03:00
bors[bot]
5a8ddb4b2d
Merge #9260
...
9260: tree-wide: make rustdoc links spiky so they are clickable r=matklad a=lf-
Rustdoc was complaining about these while I was running with --document-private-items and I figure they should be fixed.
Co-authored-by: Jade <software@lfcode.ca>
2021-06-14 07:16:48 +00:00
Jade
20b325c7d5
tree-wide: make rustdoc links spiky so they are clickable
2021-06-13 21:58:05 -07:00
Aleksey Kladov
935c53b92e
internal: use cov-mark rather than bailing out diagnostic
2021-06-13 21:55:51 +03:00
Aleksey Kladov
fc30c5ccbe
internal: refactor incorrect case diagnostics
2021-06-13 21:09:03 +03:00
bors[bot]
cc6d761a99
Merge #9246
...
9246: internal: unified missing fields diagnostic r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 12:49:37 +00:00
Aleksey Kladov
6383252cc2
internal: unified missing fields diagnostic
2021-06-13 15:48:54 +03:00
bors[bot]
be9742809c
Merge #9244
...
9244: feat: Make block-local trait impls work r=flodiebold a=flodiebold
As long as either the trait or the implementing type are defined in the same block.
CC #8961
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-06-13 11:13:31 +00:00
Florian Diebold
5ca71a1990
Make block-local trait impls work
...
As long as either the trait or the implementing type are defined in the
same block.
2021-06-13 13:00:34 +02:00
Aleksey Kladov
0eafc88079
minor: put a mark back
2021-06-13 11:49:32 +03:00
Maan2003
5ac6804bb3
cargo fmt
2021-06-13 09:48:15 +05:30
Maan2003
aabd41cafc
clippy::redundant_field_names
2021-06-13 09:40:22 +05:30
Maan2003
75370312fb
clippy::redundant_closure
2021-06-13 09:29:36 +05:30
Maan2003
6cc6dee9e9
clippy::useless_conversion
2021-06-13 09:25:55 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow
2021-06-13 09:24:16 +05:30
bors[bot]
d6737e55fb
Merge #9239
...
9239: fix: Fix coercion in match with expected type r=flodiebold a=flodiebold
Plus add infrastructure to test type mismatches without expect.
CC #8961
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-06-12 21:05:12 +00:00
Florian Diebold
20487a1b4a
Fix coercion in match with expected type
...
Plus add infrastructure to test type mismatches without expect.
2021-06-12 23:04:43 +02:00
Aleksey Kladov
0463d76a1f
internal: cross-crate cov-marks
2021-06-12 23:40:52 +03:00
Aleksey Kladov
7731714578
internal: move diagnostics infra to hir
2021-06-12 22:05:23 +03:00
Aleksey Kladov
6940cfed1e
Move some hir_ty diagnostics to hir
2021-06-12 21:00:22 +03:00
Aleksey Kladov
1b1e3de988
minor: reduce visibility
2021-06-12 17:41:47 +03:00
Aleksey Kladov
0413d51317
internal: move missing unsafe diagnostic to hir
2021-06-12 17:39:46 +03:00
Aleksey Kladov
f8009666be
internal: move inference diagnostics to hir
2021-06-12 17:17:23 +03:00
Jonas Schievink
17565f4dea
Set enable_proc_attr_macros in hir_ty TestDB
2021-06-03 18:11:33 +02:00
bors[bot]
c7eb19ebf9
Merge #9104
...
9104: Implement `#[rustc_skip_array_during_method_dispatch]` r=flodiebold a=jonas-schievink
haxx run the world
Closes https://github.com/rust-analyzer/rust-analyzer/issues/8552
Part of https://github.com/rust-analyzer/rust-analyzer/issues/9056
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-03 11:52:15 +00:00
bors[bot]
50936397cc
Merge #9105
...
9105: internal: calculate pattern adjustments r=flodiebold a=iDawer
This extends `InferenceResult` with `pub pat_adjustments: FxHashMap<PatId, Vec<Ty>>`.
Fixes #9095
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-06-03 09:55:37 +00:00
Lukas Wirth
ded4e7cc83
Fix bind patterns always being treated as ref taking patterns
2021-06-02 20:00:39 +02:00
Dawer
0a8c30a96f
internal: implement pattern adjustments.
2021-06-02 01:32:05 +05:00
Dawer
99516bbd67
minor: Avoid eprintln on panic
2021-06-02 01:32:05 +05:00
Jonas Schievink
955064b6aa
Implement #[rustc_skip_array_during_method_dispatch]
2021-06-01 21:34:08 +02:00
Jonas Schievink
f96c1a0414
Implement per-edition preludes
2021-06-01 13:39:19 +02:00
bors[bot]
71117e6812
Merge #8717
...
8717: Update match checking algorithm r=iDawer a=iDawer
I've recently got interest in the match checking to extend the current algo to support reporting witnesses of non-exhaustiveness.
It appears the algo is outdated from rustc's implementation. I decided to rewrite it based on the latest rustc's version. It is a diff-based port to ra codebase. That means you can diff-compare these files to rustc.
I'm striving to keep minimal ra-related changes in the algo to make it easier to backport future changes from the upstream.
Based on upstream algorithm of version rust-lang/rust 1.52.0-nightly (25c15cdbe
2021-04-22)
https://github.com/rust-lang/rust/blob/25c15cdbe/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs
The goal of this PR is to cover the current `missing-match-arm` diagnostic.
What is remaining to do:
- [x] Error handling. The errors that are unrelated to match checking will be handled before the check. Just like how it made in rustc.
- [x] Lowering `hir_def::expr::Pat` to `hir_ty::diagnostics::match_check::Pat`. rustc's match checking works on top of `rustc_mir_build::thir::Pat`, which is lowered from `hir::Pat` and carries some extra semantics used by the check. All unrelated checks are done there. RA could use this to rule out running the check on unimplemented cases (`Pat::ConstBlock`, etc).
- [x] ~~Proper~~Loose typecheck of match arm patterns (https://github.com/rust-analyzer/rust-analyzer/pull/8840 , https://github.com/rust-analyzer/rust-analyzer/pull/8875 ).
- [x] Tests from `hir_ty::diagnostics::match_check::tests`.
- [x] Clean up `todo`s
- [x] Test run on real repos https://github.com/rust-analyzer/rust-analyzer/pull/8717#issuecomment-847120265 .
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-05-31 21:01:52 +00:00
Dawer
e7c49666be
Expand fixme comments
2021-06-01 01:44:51 +05:00
Dawer
31b6a750f8
fix: panic on extra fields in a pattern
2021-06-01 00:49:44 +05:00
Dawer
4899ac8c05
Correct binding pattern's type; handle invalid records.
2021-06-01 00:49:44 +05:00
Dawer
3088ca0a53
Take substitutions into account.
2021-06-01 00:49:44 +05:00
Dawer
e16f413582
eprint panic context
2021-06-01 00:49:44 +05:00
Dawer
f571b62a13
minor: doc comment pat_util
2021-06-01 00:49:44 +05:00
Dawer
977ba46bb1
Test match guards, reference patterns
2021-06-01 00:49:44 +05:00
Dawer
4cce7a6407
Box field detection; test #[non-exhaustive] attribute
2021-06-01 00:49:44 +05:00
Dawer
f46a42f73a
Better tests: check if match checking bails out.
2021-06-01 00:49:27 +05:00
Dawer
e84efc4a46
Replace the old match checking algorithm
2021-06-01 00:23:09 +05:00
Dawer
894b4c64ff
Include old tests
2021-06-01 00:08:43 +05:00
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