-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static tuple used as a match arm yields weird error #14576
Comments
This is interesting as to fix it will probably require rewriting the constant expressions into pattern nodes and inlining them in the pattern matrix. |
I started a branch on this but I think it's a bit of a dead-end. What I think would ideally happen is the following:
This introduces mutability to the AST, which is a major change to what the current design is. I'm all ears for other solutions. :-) I'd love to fix this as this is just one of several reports on the same issue. |
This is accomplished by rewriting static expressions into equivalent patterns. This way, patterns referencing static variables can both participate in exhaustiveness analysis as well as be compiled down into the appropriate branch of the decision trees that match expressions are codegened to. Fixes #6533. Fixes #13626. Fixes #13731. Fixes #14576. Fixes #15393.
Fix explicit deref problems in closure capture fix the `need-mut` part of rust-lang#14562 Perhaps surprisingly, it wasn't unique immutable borrow. The code still doesn't emit any of them, and I think those won't happen in edition 2021 (which is currently the only thing implemented), since we always capture `&mut *x` instead of `&mut x`. But I'm not very sure about it.
hello rusties,
I have a program similar to this:
When I try to compile I get the following error:
Is this behavior expected?
http://j.mp/1kjSiMc
The text was updated successfully, but these errors were encountered: