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
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
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
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
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
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
fosdem.org
...Some of these are fundamental novelties, and others are optimizations matching the changing performance landscape in modern hardware.
In this talk we present Glidesort, a general purpose in-memory stable comparison sort. It is fully adaptive to both pre-sorted runs in the data similar to Timsort, and low-cardinality...
FOSDEM 2023
2023-02-08
~1 min read
doc.rust-lang.org
...Result<i32>) {
match result {
Ok(n) => println!("The first doubled is {}", n),
Err(e) => println!("Error: {}", e),
}
}
fn main() {
let numbers = vec!["42", "93", "18"];
let empty = vec![];
let strings = vec!["tofu", "93", "18"];
print(double_first(numbers));
print(double_first(empty));
print(double_first(strings));
}
This is actually fairly...
Rust by Example
Book
2024-01-01
~1 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
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
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
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
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
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
github.com
...The most obvious implementation of
(for example) the `PartialEq` trait looks like this:
```rust
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...
RFC 639
RFC
2015-01-21
~4 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
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
joonaa.dev
...Friction should also be higher, as the current behavior is overly “slidey” and does not match the average real-world material well.
Avian 0.2 changes the default coefficient of restitution to 0.0, and the default coefficients of friction to 0.5, matching Rapier.
To guide the new defaults...
Project/Tooling Updates
2024-12-25
~22 min read
justinpombrio.net
...loop {
let chunk = match stack.pop() {
Some(chunk) => chunk,
None => match chunks.split_last() {
None => return true,
Some((chunk, more_chunks)) => {
chunks = more_chunks;
*chunk
}
},
};
Then the body of the loop processes the chunk to check whether it fits on the
line:
match chunk.notation.0.as_ref() {
Newline => return...
Miscellaneous
2024-02-28
~22 min read
github.com
...Suppose `p` is some `&Path` and `dot == Path::new(".")`:
```rust
p == p.join(dot)
p == dot.join(p)
p == p.root_path().unwrap_or(dot)
.join(p.relative_path())
p.relative_path() == match p.root_path() {
None => p,
Some(root) => p.path_relative_from(root).unwrap()
}
p == p.dir_path...
RFC 474
RFC
2014-11-12
~13 min read