www.ecorax.net
...u8) {
assert!(in_range(port, index));
let register = match port {
'A' => 0x0001000,
/*...*/
} as *mut u32;
*register |= 1 << index;
}
Yeah, don't do that.
Why am I bringing it up? Because now that we have some
scaffolding in the form of unique, managed Pin structs, it doesn't really seem
that...
Rust Walkthroughs
2021-04-21
~16 min read
guillaumegomez.github.io
...Damn! It was a close call!!)
@MichaelNecio noted that shadowing never destroys a value.
@matklad simplified wording.
@withoutboats corrected the docs on str::trim_matches.
@kennytm fixed markdown formatting error of E0277, E0310 and E0502.
@ollie27 fixed rustdoc static and const generation of redirect pages and improved char::to_{lower...
New Crates & Project Updates
2016-06-20
~1 min read
www.shadaj.me
...tree_sitter::Node, source: &[u8]) -> Self {
#(#impl_body)*
match node.child(0).unwrap().kind() {
#(#match_cases),*,
_ => panic!()
}
}
}
}
An interesting trick appears when we handle the transform argument for leaf nodes, which allows users to define a closure that transforms the leaf string into a richer type. If we simply call...
Project/Tooling Updates
2022-08-17
~22 min read
grpc.io
...The Tonic codegen interface will continue to be supported to allow users to
upgrade to the new transport implementation without needing to rewrite their
application.Going forward, you can expect the gRPC team to continue adding new features
and providing ongoing maintenance of the grpc crate, matching our other
supported...
Project/Tooling Updates
2026-05-27
~1 min read
thesquareplanet.com
...Pattern matching in Rust (think of it as a switch on steroids)
is checked for completeness (i.e., all possible cases are handled)
at compile-time.
4.1: Propagating Results with try! is a common pattern in Rust,
which would effectively provide exactly this kind of behavior.
9.1: Rust...
News & Blog Posts
2016-05-30
~16 min read
rust-lang.github.io
...this:
match (self, other) {
(&Unknown(ref s1), &Unknown(ref s2)) => s1 == s2,
(&SuccessfulCompletion, &SuccessfulCompletion) => true,
(&Warning, &Warning) => true,
(&DynamicResultSetsReturned, &DynamicResultSetsReturned) => true,
(&ImplicitZeroBitPadding, &ImplicitZeroBitPadding) => true,
.
.
.
(_, _) => false
}
Even with optimisations enabled, this code is very suboptimal, producing this code. A way to extract the discriminant would allow this code:
match (self, other...
RFC 639
RFC
2015-01-21
~4 min read
seanmonstar.com
...The purpose of the roadmap is to map out what hyper looks like now, and exactly how it needs to change to match up with the VISION.
The roadmap starts by describing current known issues with hyper v0.14, after having spoken to many users.
Then, after using the tenets...
Observations/Thoughts
2022-04-06
~1 min read
rust-lang.github.io
...the type for<'a> fn(Foo<'a>) is Copy for all user-defined types Foo, but there is no way to implement Clone, which is a supertrait of Copy, for it (an impl<T> Clone for fn(T) won't match against the higher-ranked type).
The MIR shims for...
RFC 2133
RFC
2017-08-28
~4 min read
siciarz.net
...pageviews") {
println!("Pageviews: {}", pageviews);
}
}
}
We're using the if let language construct which often simplifies pattern matches where we care for only one branch and do nothing if the expression doesn't match. However, at the moment it is hidden behind a feature gate, so you'll need to add...
Blog Posts
2014-12-08
~4 min read
insanitybit.github.io
...https://github.com/rust-lang/rust/issues/29723
fn main() {
let foo = String::from("FOO");
let foo = match 0 {
0 if {
some_func(foo) // foo is freed here
} => unreachable!(),
_ => {
// Use After Free - we return freed memory
foo
}
};
println!("{:#?}", foo); // And here we access the invalid memory
}
fn some_func(foo...
News & Blog Posts
2017-01-03
~4 min read
purplesyringa.moe
...AstNode) -> String {
match node { .. }
}
fn dump(node: AstNode, fmt: &mut Formatter<'_>) {
match node { .. }
}
fn interpret(node: AstNode) -> Value {
match node { .. }
}
..
fn parse(code: &str) -> AstNode {
..
}
The second one is trait-based:struct Integer(i32);
struct Str(String);
struct Array(Vec<Box<dyn AstNode>>);
struct Add(Box<dyn AstNode>, Box<dyn...
Observations/Thoughts
2025-10-01
~16 min read
assethoard.com
...let variant = match lexer::tokenize(animations_text) {
Ok(toks) => match parser::parse_variant(toks) {
Ok(v) => v,
Err(e) => {
if format == 2 {
log::debug!(
"parse_sprite_frames: format=2 graceful degradation (parse): {}",
e
);
return Ok(SpriteFramesData::empty());
}
return Err(TresParseError::BodyParseError(format!(
"failed to parse animations Variant: {}", e
)));
}
},
...
};Unit tests...
Rust Walkthroughs
2026-05-20
~16 min read
embed.rs
...Then, it is time to decode the assembly instruction and check if it is a bkpt:
# get the current frame and inferior
frame = gdb.selected_frame()
inf = gdb.selected_inferior()
# retrieve instruction
ins = frame.architecture().disassemble(frame.pc())[0]
m = re.match(r'^bkpt\s+((?:0x)?[0-9a-f]+)$', ins...
Blog Posts
2016-10-25
~10 min read
arxiv.org
...Notably, none of the automated techniques consistently match or exceed human-written translations across all quality dimensions, yet even human-written Rust code exhibits persistent internal quality issues such as readability and non-idiomatic patterns. Together, these findings show that translation quality remains a multi-dimensional challenge, requiring systematic evaluation...
Research
2026-02-04
~1 min read
recursion.wtf
...F) -> Self::To {
match self {
Expr::Add(a, b) => Expr::Add(f(a), f(b)),
Expr::Sub(a, b) => Expr::Sub(f(a), f(b)),
Expr::Mul(a, b) => Expr::Mul(f(a), f(b)),
Expr::LiteralInt(x) => Expr::LiteralInt(x),
}
}
}
Some boilerplate, nothing too complex.
Implementing the Collapse and...
Rust Walkthroughs
2022-08-03
~7 min read
fitzgeraldnick.com
...However, it doesn’t always match libiberty’s C++
demangler’s formatting character-for-character. I’m currently in the process of
getting all of libiberty’s C++ demangling tests passing.
Additionally, I’ve been running American Fuzzy Lop (with afl.rs) on
cpp_demangle overnight. It found a panic...
News & Blog Posts
2017-02-28
~7 min read
coredumped.dev
...Unboxing requires unsafe code
Must manually match the tag to the right data type. There are no compiler checks here.
No way to match directly on the union. Need to create an accessor functions to get the underlying value as an enum.
Can’t use variants as values. With an...
Observations/Thoughts
2021-10-27
~14 min read
arxiv.org
...Yuga uses a multi-phase analysis approach, starting with a quick pattern-matching algorithm to identify potential buggy components and then conducting a flow and field-sensitive alias analysis to confirm the bugs. We also curate new datasets of lifetime annotation bugs. Yuga successfully detects bugs with good precision on...
Research
2023-10-18
~1 min read
travisf.net
...failures:
---- test::test_instruction_group_ids stdout ----
thread 'test::test_instruction_group_ids' panicked at 'Expected groups {1} does NOT match computed insn groups {110} with ', src/lib.rs:287:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
I was unable to reproduce the bug on my GNU...
News & Blog Posts
2018-09-25
~22 min read
zed.dev
...But we know that intuitive feeling is hard-earned, and we wanted Zed's split diff view to match the rest of the editor: fast, minimal, and well-crafted.
The split diff view in Zed, showing several changes in the project diff
Diffs are different in Zed
Building this new...
Project/Tooling Updates
2026-02-25
~4 min read