We're happy to announce the release of Rust 1.42.0, featuring better panic messages when unwrapping, subslice patterns, and more! Check out the highlights on the blog:
Happy to announce: fortytwo, the crate so you don't panic when using Rust 42.
- Crate: https://crates.io/crates/fortytwo
- Repository: GitHub - badboy/fortytwo: DON'T PANIC!
Sub slice matching is nice! What's the @
notation though?
What if I lost my towel?
What sweet coincidence.
Hitch Hikers Guide to the Galaxy was 42 years old a few days ago.
"42" and "Panic" are of course something of a theme in HHG2G.
I'm a little unclear about what is included and what isn't.
Are or-patterns part of this release?
What about by-ref and move bindings in the same match?
If either of them isn't part of this release, when are they planned to be released?
Minor nitpick: I miss that the matches!
macro does not support an optional leading |
before the first pattern:
matches!(
expr,
| SomeFirstPattern
| SomeOtherPattern
| ...
);
This would be consistent with Rust syntax elsewhere:
match expr {
| SomeFirstPattern $(=> ...)?
| SomeOtherPattern => ...
}
I am aware that this leading pipe is a matter of style, and that it does not match the canonical format of, for instance, rustfmt, but I have found this kind of pipe-before-pattern very useful when enumerating: in the same fashion that lacking trailing commas is annoying as soon as you want to append a new line to the enumeration, this lack of a leading pipe is annoying in breaking the "symmetry":
matches!(
expr,
SomeFirstPattern
| SomeOtherPattern
| YetAnotherPattern
| ...
);
// or
matches!(
expr,
SomeFirstPattern |
SomeOtherPattern |
YetAnotherPattern |
... |
LastPattern
);
Neither feature is part of this release.
Or patterns tracked here: Tracking issue for RFC 2535, 2530, 2175, "Or patterns, i.e `Foo(Bar(x) | Baz(x))`" · Issue #54883 · rust-lang/rust · GitHub
Move-ref patterns tracked here: https://github.com/rust-lang/rust/issues/68354
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.