github.com
## Summary
[summary]: #summary
Currently when using an if let statement and an irrefutable pattern (read always match) is used the compiler complains with an `E0162: irrefutable if-let pattern`.
The current state breaks macros who want to accept patterns generically and this RFC proposes changing this error to an error...
RFC 2086
RFC
2017-07-27
~2 min read
arXiv
arxiv.org
...Using Qwen3-4B as the primary generator under matched token budgets, DTV improves pass rates from 72.3% to 82.0% on C-to-Rust and from 33.3% to 46.0% on JavaScript-to-TypeScript relative to matched self-refinement baselines, while using fewer tokens per case; the same...
Machine Learning
Tianyang Zhou, Somesh Jha, Mihai Christodorescu et al.
2026-05-17
arXiv:2605.17626
dtrace.org
...For that we’ll use matching, another handy construct.
23 let mut v: Vec<char> = s.chars().collect();
24 v.sort();
25 let ss: String = v.into_iter().collect();
26
27 match dict.get(&ss) {
28 Some(mut v) => v.push(s),
29 _ => {
30 let mut v = Vec::new();
31...
Tips & Tricks
2015-06-29
~12 min read
blog.burntsushi.net
...PCRE2 match error: match limit exceeded
Aborted (core dumped)
The Silver Searcher fails similarly. It reports the first line as a match and
neglects the match in the third line. The rest of the search tools benchmarked
in this article handle this case without a problem.
Literal optimizations
Picking a...
News & Blog Posts
2016-09-27
~92 min read
rust-lang.github.io
...For instance, the following is an erroneous use of the match keyword:
fn match(needle: &str, haystack: &str) -> bool {
haystack.contains(needle)
}
error: expected identifier, found keyword `match`
--> src/lib.rs:1:4
|
1 | fn match(needle: &str, haystack: &str) -> bool {
| ^^^^^
It can instead be written as fn r#match...
RFC 2151
RFC
2017-09-14
~4 min read
docs.rs
...let all_matched: String = selection.iter().map(|s| s.inner_html().trim().to_string()).collect(); assert_eq!( all_matched, "<li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li>" ); // or: let all_matched: String = selection.nodes().iter().map(|s| s.inner_html...
Crate
v0.30.0
2026-11-19
rust-analyzer.github.io
#5821 Remove Unused Parameter refactoring.
#5695 completion for unstable features.
#5643 Add new consuming modifier to semantic syntax highlighting, apply consuming and mutable to methods.
#5758 structural search replace now inserts *, & and &mut in the
replacement to match any auto[de]ref in the matched code.
#5682 allow disabling specific...
Tooling
2020-08-26
~1 min read
lucumr.pocoo.org
...impl error::Error for LibError {
fn description(&self) -> &str {
match *self {
BadStatusCode => "bad status code",
IoError(err) => "encountered an I/O error",
}
}
fn detail(&self) -> Option<String> {
match *self {
BadStatusCode(code) => Some(format!("status code was {}", code)),
_ => None,
}
}
fn cause(&self) -> Option<&error::Error> {
match *self {
IoError(ref err) => Some...
Blog Posts
2014-11-10
~12 min read
crates.io
...use googletest::prelude::*; #[gtest] fn strictly_between_9_and_11() { let value = 10; expect_that!(value, gt(9).and(not(ge(11)))); } Pattern-matching One can use the macro matches_pattern! to create a composite matcher for a struct or enum that matches fields with other matchers: use googletest::prelude...
Crate
v0.14.4
2026-10-27
docs.rs
...TokenStream) -> TokenStream { let macro_string = parse_macro_input!(input as MacroString); let path = match macro_string.eval() { Ok(path) => path, Err(err) => return TokenStream::from(err.to_compile_error()), }; let content = match fs::read(&path) { Ok(content) => content, Err(err) => return TokenStream::from(macro_string.error(err).to_compile_error...
Crate
v0.3.0
2026-07-18
arXiv
arxiv.org
...Using Qwen3-4B as the primary generator under matched token budgets, DTV improves pass rates from 72.3% to 82.0% on C-to-Rust and from 33.3% to 46.0% on JavaScript-to-TypeScript relative to matched self-refinement baselines, while using fewer tokens per case; the same...
Machine Learning
Tianyang Zhou, Somesh Jha, Mihai Christodorescu et al.
2026-05-17
arXiv:2605.17626
github.com
...must_match takes 1 string argument. It will error if the field mentioned is missing or has a different type than the field the attribute is on. Examples: #[validate(must_match(other = "password2"))] contains Tests whether the string contains the substring given or if a key is present in a...
Crate
v0.21.0
2026-07-27
hackeryarn.com
...Matching multi-field select
#[macro_export]
macro_rules! query {
( from $db:ident select $( $field:ident ),+ ) => {
...
};
}
That's quite a bit of new syntax, but it all breaks down to a single new matching construct.
Repetition match syntax
The general shape for matching repetition looks like:
$ ( ... ) sep rep => {
...
$ ( ... ) rep
...
}
We need...
Rust Walkthroughs
2025-09-03
~6 min read
www.ferrisfencing.org
...The Rules
Matches are contested between two fencers, each named Ferris, and each
running in their own VM.
The fencers square off on a one-dimensional grid 10 spaces wide.
Each match consists of 5 games. The player to win the most games wins the match.
Games consist of up...
News & Blog Posts
2019-10-29
~1 min read
doc.rust-lang.org
pub const fn eq_ignore_ascii_case(&self, other: &[u8]) -> bool
slice::eq_ignore_ascii_case — Checks that two slices are an ASCII case-insensitive match.
Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries.
method
core
Stable since 1.23.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to_fit(&mut self)
String::shrink_to_fit — Shrinks the capacity of this String to match its length.
Examples
let mut s = String::from("foo");
s.reserve(100);
assert!(s.capacity() >= 100);
s.shrink_to_fit();
assert_eq!(3, s.capacity());
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
coaxion.net
...State::HaveHeader {ref header, ref mut have_header_state } => { match *have_header_state { HaveHeaderState::Skipping { to_skip: 0 } => { *have_header = HaveHeaderState::Streaming { audio: ...}; } }, } match self.state {
...
State::HaveHeader {ref header, ref mut have_header_state } => {
match *have_header_state {
HaveHeaderState::Skipping { to_skip: 0 } => {
*have_header = HaveHeaderState::Streaming { audio: ...};
}
},
} match...
News & Blog Posts
2016-11-29
~8 min read
lifthrasiir.github.io
...MyTrait;
// @matches foo/trait.Bravo.html '//pre' "Bravo.*where.*B:.*MyTrait"
pub trait Bravo<B> where B: MyTrait {}
// @matches foo/fn.charlie.html '//pre' "charlie.*where.*C:.*MyTrait"
pub fn charlie<C>() where C: MyTrait {}
pub struct Delta<D>;
// @matches foo/struct.Delta.html '//*[@class="impl"]//code' "impl.*Delta.*where...
Blog Posts
2015-01-19
~2 min read
blog.servo.org
...Selector matching has been extracted into an independent library! You can see it here.
We now have automation set up for our Gonk (Firefox OS) port, and gate on it.
Notable additions
Chris Paris landed fragment parsing in html5ever
and implemented the innerHTML setter in Servo.
Jack Moffitt added a...
Project Updates
2015-03-02
~1 min read
sled.rs
...fn may_fail() -> Result<Happy, Sad> {
/* either returns Ok(Happy) or Err(Sad) */
}
fn caller() {
match may_fail() {
Ok(happy) => println!(":)"),
Err(sad) => {
eprintln!(":(");
/* handle error */
return;
}
}
match may_fail() {
Ok(happy) => println!(":)"),
Err(sad) => {
eprintln!(":(");
/* handle error */
return;
}
}
match may_fail() {
Ok(happy) => println!(":)"),
Err(sad) => {
eprintln!(":(");
/* handle error...
News & Blog Posts
2020-04-07
~16 min read