edvong.com
...We need the compiler to verify that the context on Rule<Ctx> matches the context on the outer Matcher<Ctx>, preventing users from accidentally passing an RpcCtx rule into an AppCtx builder. Once it crosses this threshold, Ctx has fulfilled its purpose too.Inside the syntax tree (AST). Once those...
Observations/Thoughts
2026-11-25
~17 min read
nnethercote.github.io
...Compiler
The part of the compiler that does declarative macro matching is quite old.
Much of the code predated Rust 1.0, and it was the kind of code that people do
their best to avoid touching. Time for some Type 2
fun.
I made a lot of PRs to...
Observations/Thoughts
2022-04-13
~13 min read
manishearth.github.io
...cmp_nan, which disallows things like x == NaN
clone_double_ref, which disallows calling .clone() on double-references (&&T), since that’s a straightforward copy and you probably meant to do something like (*x).clone()
match_same_arms, which checks for identical match arm bodies (strong indication of a typo...
News & Blog Posts
2017-01-24
~4 min read
yodalee.me
...u8) -> Result<(), ()>;
}
bus 會 match load/store 的 addr 並選擇正確的記憶體區塊呼叫對應的 load/store,
實作 Device 的裝置再自行計算扣掉起始位址的位址,存取對應的 Vec<u8>。
下面要提到內部包了 VRAM 的 GPU;或是 Timer 接了三條硬體 IO 線,也是一樣實作 Device trait,讓 bus 把存取的呼叫直接 dispatch 給他們。
bus 的 load 實作大概像是這樣:
fn load(&self, addr: u16) -> Result<u8, ()> {
match addr {
CATRIDGE_START...
Observations/Thoughts
2021-06-23
~4 min read
blog.yoshuawuyts.com
...Pin<&mut Self>) -> Option<F::Output> {
match self.project() {
DoneState::Done(output) => output.take(),
DoneState::Future(_) => None,
}
}
}
impl<F: Future> Future for MaybeDone<F> {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
match self.as_mut().project() {
DoneState::Future(future) => match future.poll(cx) {
Poll...
Observations/Thoughts
2026-11-04
~8 min read
villagesql.com
...use villagesql::{InValue, VdfReturn};
fn rot13_impl(args: &[InValue]) -> VdfReturn {
match args.first() {
Some(InValue::String(s)) => VdfReturn::string(rot13(s)),
Some(InValue::Null) | None => VdfReturn::null(),
_ => VdfReturn::error("rot13: expected a STRING argument"),
}
}
fn rot13(s: &str) -> String {
s.chars()
.map(|c| match c {
'a'..='m' | 'A'..='M' => (c...
Rust Walkthroughs
2026-06-10
~4 min read
blog.s-m.ac
...Some manual fiddling may be required to get the memory representation to match, but often it’s just a question of shifting by a few bytes one way or another.In the present document we focus on interfacing OCaml [@leroy2013ocaml], Rust [@matsakis2014rust] and C [@ritchie1988c] but more languages support this...
News & Blog Posts
2018-07-24
~13 min read
lwn.net
...The first worked on rest
patterns — patterns in match statements that match the
remainder of a structure. Progress was made, but some patterns remain
unimplemented. The second student worked on moving the lint mechanism away
from GCC's GIMPLE internal
representation, which was unable to support generics, to the gccrs...
Project/Tooling Updates
2025-10-15
~8 min read
firedbg.sea-ql.org
...Option<usize> = None; for coin in coins { let next = m - coin; if next < 0 { continue; } count = match (count, min_coins(next, coins)) { (Some(a), Some(b)) => Some(a.min(b + 1)), (Some(a), None) => Some(a), (None, Some(b)) => Some(b + 1), (None, None) => None, } } fire::dbg!("return", count)}The...
Observations/Thoughts
2024-01-31
~4 min read
pointersgonewild.com
...If the code rustc generated for the match statement dispatch is potato, that would explain a lot.
This is the way my interpreter handled the add instruction in the old tagged enum version (ac75356, src/vm.rs:1498) using match arms to dispatch based on Value types:
Insn::add => {
let...
Observations/Thoughts
2026-08-26
~24 min read
without.boats
...Destructors referencing a freed object (use after free)The second bug occurred in this bit of code:let mut state = self.state.as_ref().lock();
if matches!(&*state, State::Completed(_)) {
callback.cancel();
self.deallocate();
} else {
*state = State::Cancelled(callback);
}
This code implements the Completion::cancel method that we called in...
News & Blog Posts
2020-06-16
~4 min read
calif.io
...The compiler checks that add(2, 3) matches that declaration. It then compiles the C++ code, but the actual implementation resides in the Rust-generated object file or library. The linker then locates the corresponding symbol and combines the compiled C++ and Rust code into an executable file.
An example...
Research
2026-11-18
~10 min read
blog.kdubovikov.ml
...chat_id };
match diesel::insert_into(subscribers).values(&subscriber).execute(connection) {
Ok(_) => Ok(subscriber),
Err(_) => Err("Error while saving new subscriber to DB")
}
} else {
Err("The subscriber already exists")
}
}
/// Deletes a subscriber from the database
pub fn unsubscribe(chat_id: i64, connection: &SqliteConnection) -> QueryResult<usize> {
diesel::delete(subscribers.filter(telegram...
Learn More Rust
2020-10-07
~13 min read
rust-analyzer.github.io
...SyntaxNode) -> SemanticElement {
match node.parent() {
None => module_for_file(node.source_file),
Some(parent) => {
// Recursive call
let parent_semantics = semantics_for_syntax(parent);
for sibling in parent_semantics.children() {
if sibling.source_syntax() == node {
return sibling
}
}
}
}
}
In this formulation, a language server needs to just enough analysis to drill down...
Rust Walkthroughs
2023-12-27
~8 min read
alexandrempsantos.com
...bool = match &json[("hasAlphaChannel")] {
serde_json::Value::Bool(b) => *b,
_ => true,
};
let width = match &json["size"]["width"] {
serde_json::Value::Number(n) => n.as_u64().unwrap_or(0),
_ => 0,
};
let height = match &json["size"]["height"] {
serde_json::Value::Number(n) => n.as_u64().unwrap_or(0),
_ => 0,
};
println!("Rust: json...
Rust Walkthroughs
2021-06-02
~10 min read
linebender.org
...This now is defined to match how Vello was interpreting it.
peniko#139: Better document Mix, Compose and Fill.
peniko#144: Deprecate Mix::Clip and make it no longer the default blend mode.
Release v0.4.1 is a backport release for the Linebender Resource Handle migration.
We expect to...
Project/Tooling Updates
2025-10-15
~4 min read
www.falkordb.com
...AI Assisted Development
The Test Ratchet
Benchmarking against the C engine to make sure we’re still the fastest
We had to match the C engine’s performance. Nobody switches to a slower database because the new one is written in Rust. So we set up benchmarking in CI early...
Project/Tooling Updates
2026-08-05
~1 min read
blog.m-ou.se
...In the matching rules of a macro, we can match on things like expressions, identifiers, types, and many other things.
Since ‘valid Python code’ is not an option, we’ll just make our macro accept anything: raw tokens, as many as needed:
macro_rules! python {
($($code:tt)*) => {
...
}
}
(See the resources...
News & Blog Posts
2020-04-21
~14 min read
blog.yoshuawuyts.com
...In order to do so we can match the
type states back to an actual enum, and wrap the type-state variant in it. This
could look something like this (playground):
use futures_lite::prelude::*;
use futures_time::prelude::*;
use futures_time::time::Duration;
use futures_time::stream;
enum TrafficLightWrapper...
Observations/Thoughts
2023-01-04
~14 min read
gfx-rs.github.io
...Not only we are shaping up the HAL API to match Vulkan as close as possible, we are also implementing a Vulkan Portability layer (for linking with C libraries using vulkan.h) in https://github.com/gfx-rs/portability .
Hardware Abstraction Layer
HAL brings a lot of goodies to the...
News & Blog Posts
2018-01-02
~1 min read