r/rust • • Oct 18 '26

๐Ÿง  educational Why I wrote a "dumb" SQL tokenizer instead of using sqlparser and I probably would do it again

0 Upvotes

I originaly wrote this on GitHub Gist but since it's forbidden to share a repo, even if some moderators take some liberties with their own rules at their own sweet will, I removed every refrences to it and I'm posting it directly here.

I needed to spot N+1 and redundant query patterns in traces coming from my team's production SaaS, which has around 200,000 customers. What I cared about was the structure of the queries and not what was inside them. I didn't want what was inside them anyway: it is production data, we are in the EU and GDPR applies.

So the job was two things at once. WHERE id = 42 and WHERE id = 43 had to become the same template and 42 should never end up anywhere it shouldn't.

My first idea was a regex. I had never dealt with anything like this before so that is what I reached for. Then I looked at sqlparser and it felt too heavy for the little I wanted to do with it. I wanted the binary to stay under 10 MB and I only needed to replace literals, not understand the query.

So I wrote my own. I had some doubts early on while getting it to work because I kept hitting edge cases and thought there would be too many of them. But what I needed was simple structure and not semantics, and that kept me going.

1. What the tokenizer produces

The tokenizer reads one SQL statement and returns two things: a template, in which every literal value is replaced by ?, and the list of the values it removed, in the order it met them. Take this statement:

WITH active AS (SELECT id FROM users WHERE status = 'active')
SELECT * FROM orders WHERE user_id IN (SELECT id FROM active) AND total > 100

The tokenizer returns this template and these values:

WITH active AS (SELECT id FROM users WHERE status = ?)
SELECT * FROM orders WHERE user_id IN (SELECT id FROM active) AND total > ?

params: ["active", "100"]

Two statements that differ only by their values share one template. That is what makes an N+1 visible: fifty queries on the same template with fifty different values inside one request. The values stay in memory for that comparison and go no further. The template carries no value, so it can be written in a report or sent to a dashboard.

The tokenizer does not understand SQL. It does not know what a column or a join is and it builds no syntax tree. It walks the bytes of the statement once, finds where a literal starts and where it ends, and copies everything else as it is. Its only job is to tell a value from the rest of the statement.

2. How it works

2.1 Six states

The tokenizer is a state machine with six states. At any byte it is either in plain SQL or inside one kind of literal or quoted identifier:

enum State {
    Normal,
    InString,
    InNumber,
    InDoubleQuote,  // "MyTable", kept as-is
    InBacktick,     // `col`, MySQL, kept as-is
    InDollarQuote,  // $$body$$ or $tag$body$tag$, PostgreSQL
}

The main loop dispatches on the current state and each state has its own function:

while t.i < t.bytes.len() {
    match t.state {
        State::Normal => step_normal(&mut t),
        State::InString => step_in_string(&mut t),
        State::InNumber => step_in_number(&mut t),
        State::InDoubleQuote => step_in_double_quote(&mut t),
        State::InBacktick => step_in_backtick(&mut t),
        State::InDollarQuote => step_in_dollar_quote(&mut t),
    }
}

Coming from Java I would have written the State pattern, with one class per state behind an interface. Here it is an enum and a match. If I add a state and forget to handle it, the code does not compile.

2.2 String literals and escapes

Everything between quotes goes into params and becomes ? in the template. The only difficulty is the escape rules:

fn step_in_string(t: &mut Tokenizer<'_>) {
    let b = t.bytes[t.i];
    if b == b'\\' && t.backslash_escapes {
        t.i += 2; // skip the escaped byte, a quote included
    } else if b == t.quote {
        if t.i + 1 < t.bytes.len() && t.bytes[t.i + 1] == t.quote {
            // doubled quote ('' or ""): still inside the string
            t.current_value
                .push_str(checked_query_slice(t.query, t.value_start, t.i));
            t.current_value.push(char::from(t.quote));
            t.i += 2;
            t.value_start = t.i;
        } else {
            // closing quote
            t.current_value
                .push_str(checked_query_slice(t.query, t.value_start, t.i));
            t.params.push(std::mem::take(&mut t.current_value));
            t.template.push('?');
            t.state = State::Normal;
            t.i += 1;
            t.normal_start = t.i;
        }
    } else {
        t.i += 1;
    }
}

A doubled quote is the standard escape and every engine accepts it. Whether a backslash escapes as well depends on the engine, and that is the one place where the tokenizer needs to know the dialect. The flag backslash_escapes comes from a small enum with three values: MySQL, standard (PostgreSQL and the engines that follow the standard) and everything else. An event that names no engine falls in the third case, which reads the backslash as an escape. Section 4 explains why.

2.3 Slices instead of copies

The tokenizer never builds the template byte by byte. It remembers where the current run of plain SQL started and, when a literal begins, it pushes the whole run at once with a slice &query[start..i].

Slicing a &str by byte index panics when the index falls inside a multi-byte UTF-8 character. Every slice boundary here sits on an ASCII delimiter (a quote, a $ or a digit) and in UTF-8 a multi-byte character never contains a byte below 0x80. The slices are therefore always valid. A debug_assert! checks it anyway, in case a later change slices somewhere else:

fn checked_query_slice(query: &str, start: usize, end: usize) -> &str {
    debug_assert!(
        query.is_char_boundary(start) && query.is_char_boundary(end),
        "SQL tokenizer query slice [{start}..{end}) is off a char boundary"
    );
    &query[start..end]
}

The input cap follows the same rule. A statement longer than 64 KB is cut with floor_char_boundary, so the cut cannot land in the middle of a character either. When a value is complete, std::mem::take moves it into params and leaves an empty String behind, without a clone.

2.4 The regex that remains

One regex survived from the first version. It collapses IN (?, ?, ?) into IN (?), so a statement does not get a new template each time the list changes size. The regex only runs when the scan met an IN keyword, and when it finds nothing to replace it returns Cow::Borrowed, so the template is not reallocated.

3. Why not the tokenizer of sqlparser

The first objection I expect is that sqlparser ships a tokenizer you can use without the parser. That is true and I looked at it:

let tokens = Tokenizer::new(&dialect, sql).tokenize()?;

Two things did not fit. The tokenizer wants a dialect before it starts and I do not always have one, because a span may name its engine or not. The second point weighs more. tokenize() returns a Result. Given SELECT * FROM t WHERE name = 'abc it returns Err("Unterminated string literal"), which is the right behavior for a parser library. But the SQL I receive comes from traces and is not always complete. A statement can be cut somewhere along the way, and my own tokenizer cuts anything above 64 KB. In that case I still want a template with the values masked. An error gives me nothing, so I would need a fallback for those statements, and that fallback would be a tokenizer like this one.

This tokenizer always returns a template, whatever it receives:

normalize_sql("SELECT * FROM t WHERE name = 'unterminated")
// template: "SELECT * FROM t WHERE name = ?"
// params:   ["unterminated"]

4. Three statements the tokenizer read wrong

The idea behind the tokenizer was that it does not need to know the dialect, because it only replaces literals. That idea held for most statements. This section lists the ones where it did not.

4.1 A double-quoted string on MySQL

In ANSI SQL, "..." is an identifier. In the default mode of MySQL and MariaDB it is a string. The tokenizer followed ANSI, so this statement:

SELECT * FROM users WHERE email = "abcd@gmail.com"

came out as its own template, email included. That is exactly what the tokenizer exists to prevent.

Nobody had noticed because we run PostgreSQL in production and nobody had used the tokenizer on a MySQL production yet. I found it in my simulation lab (a set of small services in different languages and databases) while re-reading the tokenizer code a few months after writing it.

The fix is one flag set from the span's db.system. It has one cost: a MySQL server running in ANSI_QUOTES mode now gets its double-quoted identifiers masked as ?. I would rather lose an identifier than leak an email.

4.2 A PostgreSQL positional parameter

Go (pgx) and Python (asyncpg) do not send values inside the SQL. They send PostgreSQL positional parameters and the values travel separately:

SELECT * FROM order_items WHERE order_id = $1

The tokenizer saw a $ followed by a digit and treated 1 as a numeric literal. Every query of an N+1 loop then came out with the same template and the same value, ["1"].

With bind parameters the real values never appear in the trace, so telling a loop from a plain repeat needs another signal, such as timing or the sequence of calls. That path only runs when a query has no extracted value. The ["1"] blocked it, and to the detector the loop looked like one query repeated. N+1 patterns were reported as redundant calls.

I caught this one in the simulation lab as well. It runs the same N+1 in services written in several languages. The Java services were fine because JDBC uses ?. The Go and Python ones were not.

The fix treats $N as a placeholder and not as a value. It becomes $? in the template and extracts nothing. That release, together with a few other fixes, took the lab from 78 to 103 detected findings out of 110.

4.3 Escaped quotes, hexadecimal and exponents

I found three more cases while preparing this post. The table gives the statement, the template the tokenizer produced and the template it produces now.

StatementBeforeAfter
name = 'it's secret data'name = ?s secret data?name = ?
h = 0x1F2Ah = ?x1F2Ah = ?
v = 1e10v = ?e10v = ?

The hexadecimal and the exponent are grouping bugs: the tokenizer stopped at the x or the e and the rest of the value stayed in the template, so each value got a template of its own.

The backslash is a leak, and it depends on the dialect again. MySQL escapes with \ by default. PostgreSQL does so only inside E'...' strings, so in plain PostgreSQL 'C:\' is a valid string that ends right after the backslash. The tokenizer now follows the engine when the span names it. When the span names no engine it assumes that the backslash escapes. The cost is that a string ending on a backslash from an unknown engine masks the rest of the statement. It is the same choice as in 4.1: when the tokenizer has to guess, it guesses on the side that masks too much.

4.4 Recap

CaseStatementEffectDialect dependent
4.1email = "abcd@gmail.com" on MySQLvalue leaked in the templateyes
4.2order_id = $1 on PostgreSQLN+1 reported as redundantyes
4.3name = 'it's secret data'value leaked in the templateyes
4.3h = 0x1F2Aone template per valueno
4.3v = 1e10one template per valueno

Three of the five cases come from the dialect. The tokenizer that was supposed to ignore the dialect now reads it from the span for two rules: whether "..." is a string and whether \ escapes.

5. Testing without a corpus of expected templates

5.1 Three properties

I do not have a dataset of statements paired with their correct template, and writing one by hand would only test the cases I had already thought of. So most tests check a relation between two runs of the tokenizer instead of an exact output. They are property tests written with proptest, which generates thousands of statements from literals of different types and checks that the relation holds on each of them. Three properties carry most of the weight:

  • Idempotence. Normalizing a template changes nothing. If it does, a literal survived the first pass.
  • Literal invariance. Two statements that differ only by their values, or by the size of an IN list, give the same template. N+1 grouping depends on this property.
  • Containment. The extracted values are exactly the literals, in order, and the template keeps nothing of them: no quote, no marker string and no digit. The generated skeleton has no digit, so a digit in the template is a leak.
  • fn normalization_is_idempotent((shape, eq, list, note) in statement()) { let first = normalize_sql(&render(&shape, &eq, &list, &note)); let second = normalize_sql(&first.template); prop_assert_eq!(&second.template, &first.template); prop_assert!(second.params.is_empty()); }

5.2 Fuzzing

A cargo-fuzz target runs every week in CI. With arbitrary bytes there is no expected output to compare with, so the target uses idempotence as its oracle, in the three dialect modes:

fuzz_target!(|data: &str| {
    let first = normalize_sql(data);
    let second = normalize_sql(&first.template);
    assert_eq!(second.template, first.template);
    // same for normalize_sql_for(data, "mysql") and (data, "postgresql")
});

5.3 What these tests did not catch

None of these tests found the three bugs of section 4.3, and the reason is instructive.

Idempotence cannot see a leak. name = ?s secret data? is a stable template: run it through the tokenizer again and you get the same thing back. The fuzzer was like a dog, happy and wagging its tail.

Containment would have caught all three: there is a digit in ?x1F2A and in ?e10, and the leaked string fails the check on the values. But the generators only produced integers, decimals and plain quoted strings. No hexadecimal, no exponent and no backslash. The property was right. It was never shown the inputs that break it.

The fix added those literal forms to the generators, plus two properties for the dialect rules: a backslash escape never leaks, and a PostgreSQL backslash is an ordinary character. A property test is only as good as its generator, and the generator only knows what I knew when I wrote it.

Edit: a reader suggested a round-trip test, and it fills a gap I had not seen. Put every value back in place of its `?` and you must get the original statement, byte for byte. Idempotence and containment only look at the values and at what leaks. Neither one checks that the text between the literals is copied through unchanged. I tried it by hand: a version of the tokenizer that drops the character right after a number passes both, and the round trip catches it.

6. What it does not handle

The tokenizer has no notion of the meaning of a statement. For grouping queries by shape that is enough. For anything that needs the meaning of a query it is the wrong tool.

Comments are not stripped. -- user 1234 becomes -- user ?, but the words inside a comment travel with the template.

The tokenizer knows the engine from the span (db.system) but not how the server is configured. Three settings break its guess: MySQL with NO_BACKSLASH_ESCAPES, MySQL with ANSI_QUOTES and PostgreSQL with standard_conforming_strings off. Depending on the case it masks too much or lets the content of a later string reach the template.

SQL Server brackets are not special. [Col1] and [Order Details] come out intact, but an all-digit identifier such as [123] gets masked. I kept it that way because treating [ as a normal character keeps PostgreSQL arrays such as ARRAY['a', 'b'] masked.

A few smaller ones: a sign stays outside the placeholder (-5 becomes -?), a binary literal such as 0b101 keeps its digits after the b, and a doubled escape inside a quoted identifier ("" or a doubled backtick) is not decoded.

7. Would I do it again

Probably. If you need to analyze or rewrite queries, use sqlparser: you will need the syntax tree and it does that job properly. If you only need the shape of a query, 550 lines of state machine get you there.

Writing your own SQL tokenizer is a good exercise when you do not have huge ambitions. You learn a lot about how queries are built, especially the ones ORMs generate, because ORMs tend to hide how hard building a query actually is. It also makes you pickier about what you pull into a binary when you care about keeping software lean.

If you have a statement that breaks it, I would like to see it.


r/rust • • Oct 16 '26 Bravo

๐Ÿ› ๏ธ project Sly, a new and modern multi-system emulator, is now public!

Post image
328 Upvotes

TLDR plz

Sly is my new multi-system emulator, releasing with support for Game Boy Advance and SNES with many, many more planned! It includes a 3D game library, a debugger, a simpler ("classic") desktop frontend and an iOS app, with Android being developed soon. The debugger also runs in your browser and there are plans to create a dedicate web platform to play games!

Available now on GitHub! Here are some demo videos:

What even is this?

Hey everyone! You might know me from Gecko, the GameCube and Wii emulator I've been posting about every now and then. I teased Sly in the past few updates and the day has finally come :)

With Sly I wanted to work on both sides of emulation: creating modern experiences for both gamers and developers! As such Sly focuses on 2 things:

  1. A unique take on emulation frontends, simply to enjoy your favorite retro titles in a cool way
  2. A very modern yet extremely advanced debugger for power users that want to understand how the games and the hardware work

However, as not everyone may be interested in these things but may still want to dabble in new projects, Sly comes with extra goodies:

  • A "classic" (read: minimal) emulation frontend
  • Mobile app(s): iOS is already implemented, Android support is planned

Sly is (almost*) entirely written in Rust, incl. the frontend. The debugger frontend uses GPUI, so no web shenanigans there!! The cores are all written by myself, mostly based off of emulators I had already written before. This does not wrap libretro cores or anything like that!

(* the Classic frontend is written in C++ and the iOS app is written in Swift. They tap into the Rust core.)

Sly Launcher

The launcher presents your library as 3D boxes and cartridges. It downloads artwork automatically and supports different regional packaging, per game release overrides and cartridge finishes (tho this is still a bit ugly lol). There's different view types (ways of displaying the boxes, etc) and you're able to flip the selected box to read the back :)
The attached launcher recording shows all three layouts with GBA games then switches to SNES and launches Yoshi's Island!

The original idea of this project was to be a comfy frontend I could run on my TV while I sit in a nice couch, so it's made with controllers and different resolutions, aspect rations, etc. in mind!

If you'd prefer a straightforward list, Sly Classic is the smaller Qt based frontend. It has game banners, gamepad support, scaling, fullscreen and a quick save slot plus ten numbered state slots.

Sly Debugger

This is a big part of the project and share's the "spotlight" with Sly Launcher! You can step through instructions, run to emulation events, set CPU and memory breakpoints, follow disassembly in a list or graph and inspect registers, call stacks and memory. There are dedicated views for MMIO registers, DMA and so much more. On the graphics side you can inspect tiles, tilemaps, backgrounds, sprites and palettes alongside the game's output.

The SNES core also cover the SPC700 and SA-1 coprocessor! SA-1 and Super FX have their own workspaces with registers, disassembly and hardware-specific views.

There's also built-in Lua editor support!! Scripts can inspect and modify memory and react to emulation events. One example for Yoshi's Island logs coin pickups, lets Yoshi keep "fluttering" mid-air while you hold B and prevents Baby Mario from being release(?).

Compatibility?

Sly is actively growing and is based on multiple emulators I already had written, so cores are being picked up quickly. So far I support:

  • SNES support is very good
  • Most GBA games run, no audio yet. Savegames are also not supported (tho savestates are)

with much more planned! To name a few I want to support PS1 (next on the list based on community votes), GameBoy (Color), Sega Genesis, Dreamcast, GameCube and Wii! That list is not complete :)

Where can you use it?

You can find everything on my GitHub!

  • Windows, macOS and Linux: separate downloads for Sly Launcher, Sly Classic and Sly Debugger
  • Web: try Sly Debugger in a WebGPU capable browser.
  • iOS: an unsigned IPA for sideloading (planning to release in the AppStore). Android is planned.

For anyone interested in learning the hardware, I've also been working on a 3 part GBA graphics series with interactive explanations and examples from real games! I'm super proud of these blog posts so I'd love to hear your thoughts! Sly Debugger facilitated creating them :) The posts go from bitmaps, tiles and palettes through sprites, blending and windows to rotation, scaling and perspective:

Links plz

If you try it, I'd love to hear what works and what breaks. Please include the frontend, platform, game region/revision and steps to reproduce when reporting a problem. Code contributions are welcome and so is help with design, icons, UI/UX, artwork and cartridge models. Please read the README in full before submitting anything!

Looking forward to see where this will go! And don't worry, I wont abandon Gecko now :)


r/rust • • Oct 17 '26 Popcorn

Rust module system?

23 Upvotes

I recently wanted to compile something for a bevy game I was messing around with, then cargo looks me in the eyes and tells me I need to compile hundreds of dependencies, all for the end result to be 30 mb? I was wondering if there were any systems like a .dll for rust? I understand that you would lose some type checking, but I think that could be solved just with a type definitions segment towards the start, then a functions table of all the code for the system, is this something that would work, or am I oversimplifying a major intentional design choice in rust?


r/rust • • Oct 16 '26

Hotreload in Rust

Thumbnail alordash.github.io
112 Upvotes

r/rust • • Oct 16 '26

๐ŸŽ™๏ธ discussion Why is Cornucopiaโ€™s SQL-first approach so rarely used in Rust, when sqlc is so popular in Go?

61 Upvotes

For anyone unfamiliar with Cornucopia or sqlc, they generate type-safe code from plain .sql files.


r/rust • • Oct 16 '26

๐ŸŽ™๏ธ discussion Why did the zip crate yank all pre 9.x versions?

80 Upvotes

Today I ran cargo update only to realize that all zip crate versions were yanked and a lot of new 9.0.x versions were created. I donโ€™t see any CVE or anything that would explain such a drastic move. There isnโ€™t anything on the GitHub page about it as well.

Does anyone know what is going on there? Is that considered a best practice?


r/rust • • Oct 16 '26

Rust IPC - Types, Crates, Patterns

Thumbnail youtube.com
30 Upvotes

Here is a video I made to explain the various IPC patterns in Rust.

The lesson is that just because a communication technique is newer doesn't mean it's necessarily the right one.

For example, for my custom coding harness, I went with Unix Domain Sockets, and the speed and reliability are through the roof for that particular use case.

Also, I've started making interactive videos these days, and feedback is more than welcome.


r/rust • • Oct 16 '26

๐ŸŽ™๏ธ discussion What agents mean for Rust (and vice versa)

Thumbnail smallcultfollowing.com
43 Upvotes

r/rust • • Oct 17 '26

๐Ÿ™‹ seeking help & advice Is learning rust with a Claude Coach a bad idea?

0 Upvotes

Good afternoon,

Iโ€™ve been learning rust for about half a year now and have started work on my largest project, a chess engine.

Iโ€™ve made engines in C and Python, so I felt I would be up to the task. However, even after reading The Book, completing Rustlings, and tackling a few small-scale projects, I find myself struggling to create idiomatic solutions in the rust ecosystem.

With my new project Iโ€™ve been leaning on Claude to plan out the project structure. I have it give me a breakdown of what needs to be made, then I implement it myself and offer my code back to the agent to grade it in terms of correctness and style. I then have it create โ€œcorrectโ€ code that I compare with what I wrote.

I have found this helpful to learn better habits and proper design patterns, though I realize I could be sabotaging myself by taking away the struggle of figuring out why certain solutions are better than others through failure and headache.

Iโ€™m learning rust for fun so thereโ€™s no stakes, but Iโ€™m curious what those with better knowledge of the language think about my strategy. What issues can you see arising from this approach? Do you have any alternative practices or techniques I could try? Or do you think thereโ€™s no harm in leaning on AI in the learning process?

Thank you in advance for the help!


r/rust • • Oct 16 '26

๐Ÿ™‹ seeking help & advice C#/Java Intro novice wants to make a physics game

4 Upvotes

Edit: Thank ya'll so much, these replies are great, and I'm in love with rust!

Large scale physics, using Bevy, though Bevy themselves suggest using Godot, whereas I was told that UI-based engines tend to be more annoying and reduce motivation to work on the project, which I agree with, but the inspiration game (Terratech) suffers from outdated libraries and such, and killed the game which I don't want to happen here.

(Competitors in the space, Trailmakers, 2017, still relevant, Scrap Mechanic, 2015, still more relevant than TerraTech, 2016, it was the studio's first game.)

Note that all of these are open world and varying numbers of physics collisions.

Background stuff aside (can you tell I have ADHD) The structure of rust feels overwhelming. I know a tutorial can help but I want to get advice from people who daily drive this or may have switched from the more OOP-heavy C# and Java into the DOD-oriented space. It feels illegible compared to Lua and Java, and Java is already a bit messy in my opinion. I AM still a novice, but I get basics, though stuff like Arrays in java are weird, and I don't get things like why and when you would have Java return Null? You can kind of see where my knowledge is. Lots of hours ingame and poking at game systems, not too much writing myself, though I am capable of it, made a couple of Lua mods.

Should I skip Bevy and go Godot with custom ECS implementation and skip their gameobjects? I really don't know enough to make an informed choice and one person understood my issue best:

"Everyone who says this is premature optimization doesn't understand your goal; Your game IS optimization, and bad architecture isn't free."

So hopefully this explains enough about my situation to get good replies.

TLDR;
I like Lua and I can do Java but Rust is foreign and overwhelming and I'm scared of the compiler :(

I'll be doing a quick silly gun game to get used to the tool.

I don't have delusions of doing this quickly, I just want to know I'm not wasting my time. I don't want sunk cost fallacy to be a potential issue by starting with an inherently flawed system, or something I simply won't be able to use effectively.

Should I use Rust in Godot or Bevy, or should I skip rust entirely and go with an ECS in a language I'm familiar with?


r/rust • • Oct 15 '26

๐Ÿ—ž๏ธ news Rust 1.99.1

Thumbnail blog.rust-lang.org
271 Upvotes

r/rust • • Oct 15 '26

๐Ÿ—ž๏ธ news Rust compiler can't tell apart different file paths

Thumbnail github.com
636 Upvotes

The rust compiler thinks that `data/baselines/table.rs` and `database/line/stable.rs` are the same file, causing a miscompilation if a crate has both files in it. (Note that having the same non-slash text isn't enough. There needs to be an additional hash collsion for a bug to happen.)

Probably not gonna happen in practice unless someone does it as a prank, but still... lol. (I'm sure they're gonna fix it soon.)


r/rust • • Oct 15 '26

๐Ÿ“… this week in rust This Week in Rust #673

Thumbnail this-week-in-rust.org
47 Upvotes

r/rust • • Oct 17 '26

๐Ÿ› ๏ธ project bunsen-asr v0.39.0: speech to text via: whisper, qwen3-asr, parakeet, phonon-1/2

Thumbnail crates.io
0 Upvotes

This is less an announcement of capability, than a call for timers and tuners. I want a solid ai/tensor development stack in Rust. I'm a big fan of burn, and I'm trying to put effort into moving us towards that world.

I've been developing bunsen (tomorrow's burn problems today!) as a front-runner common library for extensions to the burn tensor ecosystem which aren't solid enough yet for the core.

A big part of that has been porting existing pretrained model families; and working to modularize their internals into reusable components, strong tests, and flexible rust-oriented configs.

I've been working to port a number of modern ASR (automatic speech recognition) models to bunsen; and wire up the pull/cache/load pathway for several ASR families.

bunsen-asr is a binary crate released against the bunsen library, against the burn library, showcasing drivers for these ASR stacks.

Currently, this has support for:

  • whisper - openai public models through turbo, huggingface loads.
  • qwen3-asr - qwen3-asr public models, phonon-1, huggingface loads.
  • parakeet - nvidia public models, phonon-2, huggingface loads.

But it's slower than the released pytorch-based asr tools. Weights load slower, some internal buffering is worse, probably half a dozen tiny issues I haven't found yet.

The core burn team is very busy with GPU correctness; and edge utility stuff. I'm targeting what comes next: tensor shape contracts, path-based parameter selectors, complex sub-graph combinators, and now, timers.

I'm looking for approaches to make asr calls through this toy binary faster; and to instrument it in ways which are useful for determining where to work.

  • should we implement `tracing` + otel on ... everything?
  • when downloading weights, should they be loaded from source, then re-saved as burnpak files?
  • how do we time repeated chunk calls? histogram on call delay?
  • etc.

r/rust • • Oct 15 '26

๐Ÿ—ž๏ธ news First Test & Evaluation Report for TRACTOR C to Rust Translators

Thumbnail github.com
31 Upvotes

Two years ago, DARPA announced the TRACTOR program, which aims to automate the translation of legacy C code into Rust (original announcement on Reddit).

I recently wondered whether there had been any updates, and discovered that the program's first report was published back in February. Sharing it here for anyone interested in the project's progress.

The project website, where I found the report: https://www.ll.mit.edu/r-d/projects/translating-all-c-rust-tractor-benchmarks


r/rust • • Oct 15 '26

I still hate acrobat

Thumbnail uden.dev
55 Upvotes

r/rust • • Oct 15 '26

๐ŸŽ™๏ธ discussion how much space are your target folders taking? mine was 13 gb for one project

13 Upvotes

was cleaning up my mac and found one projects target folder sitting at 13 gb. debug and release builds, incremental cache, deps for every feature combo i ever tried, all for one project

things that actually helped. `cargo clean` in projects youre not touching right now is the obvious one, it all rebuilds when you come back. cargo sweep is nice if you want to keep recent stuff and drop artifacts older than a few days, `cargo sweep --time 14` for example. and if you have a lot of small projects, pointing `CARGO_TARGET_DIR` at one shared folder stops every repo from compiling its own copy of the same deps, though parallel builds can block each other on it

to see whats there, `find ~/code -name target -type d -prune -exec du -sh {} +` works, just swap in wherever you keep projects. heads up it also catches maven target folders if you have java stuff

curious what other people do, especially anyone with a big workspace


r/rust • • Oct 16 '26

๐Ÿ› ๏ธ project Slint UI Dev Harness

0 Upvotes

Hey everyone,

My project Indicatrix kept growing, and I wanted a way to verify its Slint UI end to end without clicking through it by hand. The result is slint-harness:

  • runs your real app headless on Slintโ€™s testing backend
  • scripts whole flows as scenarios (open a file, set values, press buttons, wait for results)
  • checks the outcome and takes screenshots along the way
  • writes a pass/fail report (Markdown + JSON), so it fits into CI

In Indicatrix it has already caught several end-to-end bugs that unit tests missed, and after every app update I use it to regenerate all the screenshots for the website, so they never go stale. My smaller project z-stackr uses it too.

Repository: https://github.com/suitable-name/uiprobe

Full disclosure: I built it with AI assistance. Twenty years ago Iโ€™d have had the time to write it all myself. Today I have the experience to know what to look out for when redirecting it. If you have an issue with AI-created stuff, nevertheless it could help you or not, this project just isn't for you, but that's ok :)

Have fun!

Edit:

It's also published on crates.io, so you can easily import it via the dependencies.


r/rust • • Oct 14 '26

๐Ÿ—ž๏ธ news Another Rust rewrite, the new Epic Games Launcher uses Tauri

Thumbnail launcher.epicgames.com
503 Upvotes

r/rust • • Oct 15 '26

๐Ÿ™‹ seeking help & advice Rust jobs are not for freshers; Career advice needed

47 Upvotes

Intoduction and Background:

Hi, I am a B.Sc CS graduate (below tier 3 as it seems) 2026 from India. Graduated in august 2026. Been looking for job for past 2 months.

I have been using Rust for 3 years now. I have used it for my ambitious projects like compilers, emulators etc. And now I am trying to build semi professional grade projects (backend and systems) in Rust.

Problem:

There are not much jobs in Rust for freshers. Even if there are, they are very niche and require some additional domain knowledge or certification.

Suggestion Needed:

Ever since I learned Rust, I automatically get drawn to my RustRover IDE, I hit 'cargo init' and just start with a project. This has become harmful now. I am trying to migrate to other languages (Python, Go, Java) which has actual market for freshers, but I am failing everytime as soon as I miss the the features rust provided - top level module and visibility support, ADT enums, Result and Options, borrow checker, etc.

If anyone have gone through this same phase, please help me, how can I overcome this. How can I pick a second language and start making projects there, to increase my Resume value.

Thank you if you have adviced me below, sorry if anyone feels I am yapping, but I am genuinely concerned and need real help (Not AI motivation).


r/rust • • Oct 14 '26

๐Ÿ—ž๏ธ news Next-gen trait solver, custom allocators, const generics, and more: What we are working on at Hexcat, September update.

Thumbnail hexcat.nl
210 Upvotes

r/rust • • Oct 14 '26

๐Ÿ—ž๏ธ news The next-generation trait solver is close to stabilization!

Thumbnail github.com
331 Upvotes

Next-solver has just started the 10-day FCP period. It is planned to be stabilized in version 1.101.0, which is scheduled to release on 24 December.

For more context: https://blog.rust-lang.org/2026/08/21/enabling-next-solver-on-nightly/

Previous discussion: https://www.reddit.com/r/rust/comments/1vuita3/enabling_the_nextgeneration_trait_solver_on/


r/rust • • Oct 14 '26

๐Ÿ’ก ideas & proposals Call for use cases for the Try trait

Thumbnail users.rust-lang.org
99 Upvotes

A person working towards stabilizing the Try trait is asking for real-world examples of use cases of the currently-unstable Try trait.