Commit Graph

50 Commits

Author SHA1 Message Date
Ralf Jung
c4ec12f4b7 adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +02:00
surechen
a8f3c7684d fixes #114896 2023-09-07 11:07:33 +08:00
Sebastian Toh
d87b87d10e Improve clarity of diagnostic message on non-exhaustive matches 2023-09-03 19:55:11 +08:00
Sebastian Toh
43dd8613a3 Add note when matching on nested non-exhaustive enums 2023-08-28 14:50:32 +08:00
Sebastian Toh
a293619caa Add note that str cannot be matched exhaustively 2023-08-28 13:02:37 +08:00
Sebastian Toh
82ce7b1461 Add note when matching on tuples/ADTs containing non-exhaustive types 2023-08-21 11:18:20 +08:00
b-naber
5a9af37370 address review 2023-07-28 11:20:11 +00:00
b-naber
e1e755311a add more tests 2023-07-17 22:06:32 +00:00
b-naber
65f92a52bf address review 2023-07-17 22:06:32 +00:00
b-naber
843e2ee5d5 add test for nested pattern 2023-07-17 22:06:32 +00:00
b-naber
39c2785aec add tests for refutable patterns 2023-07-17 22:02:09 +00:00
b-naber
e18e3761ce add test, bless tests 2023-07-17 22:00:43 +00:00
Eric Mark Martin
7dfb9eda25 add regression test 2023-07-01 02:28:15 -04:00
Eric Mark Martin
e79b179412 add comment back 2023-06-28 01:51:53 -04:00
Eric Mark Martin
fbd1e0252f add note for non-exhaustive matches with guards 2023-06-28 01:51:53 -04:00
Michael Goulet
e304a1f13b Revert "Structurally resolve correctly in check_pat_lit"
This reverts commit 54fb5a48b9.
2023-06-24 18:41:27 +00:00
Oli Scherer
d030ece6f7 Only rewrite valtree-constants to patterns and keep other constants opaque 2023-05-31 14:02:57 +00:00
Matthias Krüger
9e47e90071
Rollup merge of #111558 - c410-f3r:t3st3ss, r=WaffleLapkin
Move tests

r? `@petrochenkov`
2023-05-29 21:34:16 +02:00
Camille GILLOT
ee27c49dfc Add NOTE annotations. 2023-05-25 18:17:02 +00:00
Camille GILLOT
320f6f43f6 Add inter-crate test. 2023-05-25 17:04:14 +00:00
Caio
25e395653d Move tests 2023-05-24 19:35:59 -03:00
Urgau
c93d9c1794 Rename drop_ref lint to dropping_references 2023-05-21 14:16:41 +02:00
Urgau
1c7ab18c08 Rename drop_copy lint to dropping_copy_types 2023-05-21 13:37:32 +02:00
bors
9239760da8 Auto merge of #105750 - oli-obk:valtrees, r=lcnr
Always fall back to PartialEq when a constant in a pattern is not recursively structural-eq

Right now we destructure the constant as far as we can, but with this PR we just don't take it apart anymore. This is preparatory work for moving to always using valtrees, as these will just do a single conversion of the constant to a valtree at the start, and if that fails, fall back to `PartialEq`.

This removes a few cases where we emitted the `unreachable pattern` lint, because we stop looking into the constant deeply enough to detect that a constant is already covered by another pattern.

Previous work: https://github.com/rust-lang/rust/pull/70743

This is groundwork towards fixing https://github.com/rust-lang/rust/issues/83085 and https://github.com/rust-lang/rust/issues/105047
2023-05-16 13:10:24 +00:00
Nilstrieb
f65281534f
Rollup merge of #111428 - bvanjoi:fix-109250, r=Nilstrieb
refactor(resolve): clean up the early error return caused by non-call

closes https://github.com/rust-lang/rust/issues/109250

It seems no bad happened, r? ``@Nilstrieb``
2023-05-16 11:39:38 +02:00
Oli Scherer
ad424e65d8 Always fall back to PartialEq when a constant in a pattern is not recursively structural-eq 2023-05-15 14:20:31 +00:00
Urgau
61ff2718f7 Adjust tests for new drop and forget lints 2023-05-10 19:36:02 +02:00
bohan
7c1bc0353b refactor(resolve): clean up the early error return caused by non-call 2023-05-10 22:35:01 +08:00
Ezra Shaw
87a1b3840e
tweak spans for ref mut suggestion 2023-05-05 22:40:05 +12:00
yukang
f54489978d fix tests 2023-05-01 16:15:17 +08:00
Nilstrieb
c63b6a437e Rip it out
My type ascription
Oh rip it out
Ah
If you think we live too much then
You can sacrifice diagnostics
Don't mix your garbage
Into my syntax
So many weird hacks keep diagnostics alive
Yet I don't even step outside
So many bad diagnostics keep tyasc alive
Yet tyasc doesn't even bother to survive!
2023-05-01 16:15:13 +08:00
Oli Scherer
334423263a Run check_match and check_liveness when MIR is built instead of having an explicit phase for them 2023-04-21 22:32:38 +00:00
Camille GILLOT
4f97540432 Reinstate confusion note. 2023-04-03 15:59:21 +00:00
Camille GILLOT
05082f57af Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
Camille GILLOT
28d74a9b72 Shrink binding span. 2023-04-03 15:59:21 +00:00
Jamen Marz
73c34cbaf7 Add notes to non-structural const in pattern error message 2023-03-27 11:08:11 -04:00
Ezra Shaw
bd1732240b
error-msg: impl better suggestion for E0532 2023-03-15 22:19:54 +13:00
Vadim Petrochenkov
b3ee735993 resolve: Remove struct_field_names_untracked 2023-03-13 17:31:55 +04:00
Esteban Küber
62ba3e70a1 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
Matthias Krüger
e8c17de11d
Rollup merge of #106978 - mejrs:mir_build3, r=davidtwco
Migrate mir_build's borrow conflicts

This also changes the error message slightly, for two reasons:

- I'm not a fan of saying "value borrowed, by `x`, here"
- it simplifies the error implementation significantly.
2023-01-26 15:02:20 +01:00
Matthias Krüger
9e3f330656
Rollup merge of #106897 - estebank:issue-99430, r=davidtwco
Tweak E0597

CC #99430
2023-01-25 22:19:52 +01:00
--global
734f375019 Change bindings_with_variant_name to deny-by-default 2023-01-20 02:26:12 -05:00
mejrs
6fe4cf795b Migrate mir_build's borrow conflicts 2023-01-17 13:48:43 +01:00
Esteban Küber
656db98bd9 Tweak E0597
CC #99430
2023-01-15 19:46:20 +00:00
Ezra Shaw
1babece1e8
suggest fix for attempted integer identifier in patterns 2023-01-14 12:51:20 +13:00
mejrs
372ac9c1a2
Translate Overlap eagerly 2023-01-11 14:40:13 -08:00
mejrs
8476c517c0
Don't recommend if let if let else works 2023-01-11 14:40:07 -08:00
mejrs
31c20210b9
Migrate pattern matching 2023-01-11 14:40:02 -08:00
mejrs
5d2b9a9ed0
Migrate deconstruct_pat.rs 2023-01-11 14:39:49 -08:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00