Commit da78127
authored
Rollup merge of rust-lang#64508 - Centril:or-pat-hir, r=matthewjasper
or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR
Following up on work in rust-lang#64111, rust-lang#63693, and rust-lang#61708, in this PR:
- We change `hair::Arm.patterns: Vec<Pattern<'_>>` into `hir::Arm.pattern: Pattern<'_>`.
- `fn hair::Arm::top_pats_hack` is introduced as a temporary crutch in MIR building to avoid more changes.
- We change `hir::Arm.pats: HirVec<P<Pat>>` into `hir::Arm.pat: P<Pat>`.
- The hacks in `rustc::hir::lowering` are removed since the representation hack is no longer necessary.
- In some places, `fn hir::Arm::top_pats_hack` is introduced to leave some things as future work.
- Misc changes: HIR pretty printing is adjusted to behave uniformly wrt. top/inner levels, rvalue promotion is adjusted, regionck, and dead_code is also.
- Type checking is adjusted to uniformly handle or-patterns at top/inner levels.
To make things compile, `p_0 | ... | p_n` is redefined as a "reference pattern" in [`fn is_non_ref_pat`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html#method.is_non_ref_pat) for now. This is done so that reference types are not eagerly stripped from the `expected: Ty<'tcx>`.
- Liveness is adjusted wrt. the `unused_variables` and `unused_assignments` lints to handle top/inner levels uniformly and the handling of `fn` parameters, `let` locals, and `match` arms are unified in this respect. This is not tested for now as exhaustiveness checks are reachable and will ICE.
- In `check_match`, checking `@` and by-move bindings is adjusted. However, exhaustiveness checking is not adjusted the moment and is handled by @dlrobertson in rust-lang#63688.
- AST borrowck (`construct.rs`) is not adjusted as AST borrowck will be removed soon.
r? @matthewjasper
cc @dlrobertson @varkor @oli-obkFile tree
22 files changed
+373
-485
lines changed- src
- librustc_ast_borrowck/cfg
- librustc_mir
- build/matches
- hair
- cx
- pattern
- librustc_passes
- librustc_typeck/check
- librustc
- hir
- lowering
- middle
- libsyntax
- test/ui/lint
22 files changed
+373
-485
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1103 | 1103 | | |
1104 | 1104 | | |
1105 | 1105 | | |
1106 | | - | |
| 1106 | + | |
1107 | 1107 | | |
1108 | 1108 | | |
1109 | 1109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | 437 | | |
467 | 438 | | |
468 | 439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
| 306 | + | |
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
| 346 | + | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
374 | | - | |
| 374 | + | |
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
427 | | - | |
| 427 | + | |
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | 437 | | |
448 | 438 | | |
449 | 439 | | |
| |||
592 | 582 | | |
593 | 583 | | |
594 | 584 | | |
595 | | - | |
| 585 | + | |
596 | 586 | | |
597 | 587 | | |
598 | 588 | | |
| |||
603 | 593 | | |
604 | 594 | | |
605 | 595 | | |
606 | | - | |
| 596 | + | |
607 | 597 | | |
608 | 598 | | |
609 | 599 | | |
| |||
645 | 635 | | |
646 | 636 | | |
647 | 637 | | |
648 | | - | |
| 638 | + | |
649 | 639 | | |
650 | 640 | | |
651 | 641 | | |
| |||
1079 | 1069 | | |
1080 | 1070 | | |
1081 | 1071 | | |
1082 | | - | |
| 1072 | + | |
1083 | 1073 | | |
1084 | 1074 | | |
1085 | 1075 | | |
1086 | 1076 | | |
1087 | 1077 | | |
1088 | 1078 | | |
1089 | 1079 | | |
1090 | | - | |
| 1080 | + | |
1091 | 1081 | | |
1092 | 1082 | | |
1093 | 1083 | | |
| |||
1158 | 1148 | | |
1159 | 1149 | | |
1160 | 1150 | | |
1161 | | - | |
| 1151 | + | |
1162 | 1152 | | |
1163 | 1153 | | |
1164 | 1154 | | |
| |||
1244 | 1234 | | |
1245 | 1235 | | |
1246 | 1236 | | |
1247 | | - | |
| 1237 | + | |
1248 | 1238 | | |
1249 | 1239 | | |
1250 | 1240 | | |
| |||
1279 | 1269 | | |
1280 | 1270 | | |
1281 | 1271 | | |
1282 | | - | |
| 1272 | + | |
1283 | 1273 | | |
1284 | 1274 | | |
1285 | 1275 | | |
| |||
1474 | 1464 | | |
1475 | 1465 | | |
1476 | 1466 | | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
| 1467 | + | |
1481 | 1468 | | |
1482 | 1469 | | |
1483 | 1470 | | |
1484 | | - | |
| 1471 | + | |
1485 | 1472 | | |
1486 | 1473 | | |
1487 | 1474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
885 | | - | |
886 | | - | |
887 | | - | |
| 885 | + | |
888 | 886 | | |
889 | 887 | | |
890 | 888 | | |
891 | 889 | | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
905 | 897 | | |
906 | 898 | | |
907 | 899 | | |
908 | | - | |
| 900 | + | |
909 | 901 | | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
916 | 932 | | |
917 | 933 | | |
918 | 934 | | |
919 | 935 | | |
920 | | - | |
921 | | - | |
922 | | - | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
923 | 940 | | |
924 | 941 | | |
925 | 942 | | |
| |||
1259 | 1276 | | |
1260 | 1277 | | |
1261 | 1278 | | |
1262 | | - | |
| 1279 | + | |
1263 | 1280 | | |
1264 | 1281 | | |
1265 | 1282 | | |
1266 | 1283 | | |
1267 | 1284 | | |
1268 | 1285 | | |
1269 | | - | |
1270 | | - | |
| 1286 | + | |
| 1287 | + | |
1271 | 1288 | | |
1272 | 1289 | | |
1273 | 1290 | | |
1274 | 1291 | | |
1275 | 1292 | | |
1276 | 1293 | | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
1277 | 1305 | | |
1278 | 1306 | | |
1279 | 1307 | | |
| |||
0 commit comments