-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Allow type ascription on patterns and expressions #10502
Comments
+1, but I think we should hold off on adding more features to for loops as long as they're a parser expansion hack. There's a serious need to get this moved into the compiler to provide saner semantics and comprehensible error messages. |
The for-loops would follow automatically from allowing it in patterns, i.e. let ((a, b): (u8, uint), c) = ((1, 2), "foo"); would be handled by the same path. |
I don't think it currently has a |
match foo {
(x: u8, y) => { ... }
} is also a pattern context. |
Ah, I didn't realize the type annotations worked there. That would be fine! |
How tightly should type ascription bind? In Haskell it binds looser than everything else (so in |
cc @pcwalton (he wanted this) |
I want this too. It's probably good enough to just allow type ascription on bindings, not on arbitrary patterns, which helps address @glehel's question of how tightly they should bind. |
Have to think about how this interacts with the current |
@nick29581 Should this be closed in favor of rust-lang/rfcs#354? |
yes |
fix `almost_swapped`: Ignore external macros Fixes rust-lang#10421 ; Related to rust-lang#10499 (Fixing points *1* and *3* from rust-lang#10421) changelog: [`almost_swapped`]: Add a check to ignore external macros
It'd be nice if
allowed the programmer to give explicit type hints/annotations to patterns and expressions.
The text was updated successfully, but these errors were encountered: