Conversation
brauliobz
commented
Mar 10, 2018
- added MatchArms to make things clearer
- added attributes to both the match block and match arms
- removed pipes before the patterns, since they're experimental
- added MatchArms to make things clearer - added attributes to both the match block and match arms - removes pipes before the patterns, since they're experimental
|
Pipes before the patterns are being stabilized in 1.25. |
goodmanjonathan
left a comment
There was a problem hiding this comment.
With the comment fixed, lgtm.
Are they really? Where can I follow that? Here: https://github.com/rust-lang/rust/milestone/44 ? I would prefer to only consider things stable when the stable build is published. |
|
rust-lang/rust#47947 I added the pipes as a prerequisite for the stabilization, so please keep them. |
Ok, that makes all sense 👍 . |
| > _MatchArm_ `=>` ( [_BlockExpression_] | [_Expression_] ) `,`<sup>?</sup> | ||
| > | ||
| > _MatchArm_ : | ||
| > [_OuterAttribute_]<sup>\*</sup> _MatchArmPatterns_ _MatchArmGuard_ |
There was a problem hiding this comment.
Can you give an example of the OuterAttribute here?
There was a problem hiding this comment.
I can't think of a useful example...
There was a problem hiding this comment.
I tried something like this, but the attribute doesn't apply to the use of deprecated USBType::A and rustc warns about both things instead (unused attribute and use of deprecated item):
enum USBType {
#[deprecated] A,
B,
C,
}
fn describe(ty: USBType) -> &'static str {
use USBType::*;
match ty {
#[allow(deprecated)] A => "",
B => "",
C => ""
}
}There was a problem hiding this comment.
So it's allowed by the grammar, but doesn't seem to have a use case? Weird, but as long as it's legal...
|
💟 Thanks! |