mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
6f8fb911ad
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. |
||
---|---|---|
.. | ||
benches | ||
src | ||
Cargo.toml | ||
README.md |
For more information about how rustc works, see the rustc dev guide.