Commit 6f8fb91
authored
Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank
Allow destructuring opaque types in their defining scopes
fixes #96572
Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck.
```rust
type T = impl Copy;
let foo: T = (1u32, 2u32);
let (a, b) = foo;
```
The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.File tree
47 files changed
+396
-205
lines changed- compiler
- rustc_borrowck/src
- diagnostics
- type_check
- rustc_codegen_cranelift/src
- rustc_codegen_ssa/src/mir
- rustc_const_eval/src
- interpret
- transform
- check_consts
- rustc_middle/src/mir
- rustc_mir_build/src
- build
- expr
- matches
- thir
- cx
- pattern
- rustc_mir_dataflow/src/move_paths
- rustc_mir_transform/src
- src
- test/ui/type-alias-impl-trait
- tools/clippy/clippy_utils/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
47 files changed
+396
-205
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2093 | 2093 | | |
2094 | 2094 | | |
2095 | 2095 | | |
2096 | | - | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
2097 | 2099 | | |
2098 | 2100 | | |
2099 | 2101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| |||
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
| 290 | + | |
289 | 291 | | |
290 | 292 | | |
291 | 293 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1788 | 1788 | | |
1789 | 1789 | | |
1790 | 1790 | | |
| 1791 | + | |
1791 | 1792 | | |
1792 | 1793 | | |
1793 | 1794 | | |
| |||
2179 | 2180 | | |
2180 | 2181 | | |
2181 | 2182 | | |
| 2183 | + | |
2182 | 2184 | | |
2183 | 2185 | | |
2184 | 2186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| |||
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
325 | 337 | | |
326 | 338 | | |
327 | 339 | | |
| |||
525 | 537 | | |
526 | 538 | | |
527 | 539 | | |
| 540 | + | |
528 | 541 | | |
529 | 542 | | |
530 | 543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
793 | 806 | | |
794 | 807 | | |
795 | 808 | | |
| |||
1195 | 1208 | | |
1196 | 1209 | | |
1197 | 1210 | | |
1198 | | - | |
| 1211 | + | |
1199 | 1212 | | |
1200 | 1213 | | |
1201 | 1214 | | |
| 1215 | + | |
1202 | 1216 | | |
1203 | 1217 | | |
1204 | 1218 | | |
| |||
2493 | 2507 | | |
2494 | 2508 | | |
2495 | 2509 | | |
| 2510 | + | |
2496 | 2511 | | |
2497 | 2512 | | |
2498 | 2513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
| 828 | + | |
828 | 829 | | |
829 | 830 | | |
830 | 831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
618 | 626 | | |
619 | 627 | | |
620 | 628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
414 | 429 | | |
415 | 430 | | |
416 | 431 | | |
| |||
459 | 474 | | |
460 | 475 | | |
461 | 476 | | |
| 477 | + | |
462 | 478 | | |
463 | 479 | | |
464 | 480 | | |
| |||
0 commit comments