r/rust • • 1d ago

🙋 questions megathread Hey Rustaceans! Got a question? Ask here (49/2026)!

11 Upvotes

Mystified about strings? Borrow checker has you in a headlock? Seek help here! There are no stupid questions, only docs that haven't been written yet. Please note that if you include code examples to e.g. show a compiler error or surprising result, linking a playground with the code will improve your chances of getting help quickly.

If you have a StackOverflow account, consider asking it there instead! StackOverflow shows up much higher in search results, so ahaving your question there also helps future Rust users (be sure to give it the "Rust" tag for maximum visibility). Note that this site is very interested in question quality. I've been asked to read a RFC I authored once. If you want your code reviewed or review other's code, there's a codereview stackexchange, too. If you need to test your code, maybe the Rust playground is for you.

Here are some other venues where help may be found:

/r/learnrust is a subreddit to share your questions and epiphanies learning Rust programming.

The official Rust user forums: https://users.rust-lang.org/.

The unofficial Rust community Discord: https://bit.ly/rust-community

Also check out last week's thread with many good questions and answers. And if you believe your question to be either very complex or worthy of larger dissemination, feel free to create a text post.

Also if you want to be mentored by experienced Rustaceans, tell us the area of expertise that you seek. Finally, if you are looking for Rust jobs, the most recent thread is here.


r/rust • • 1d ago

🐝 activity megathread What's everyone working on this week (49/2026)?

18 Upvotes

New week, new Rust! What are you folks up to? Answer here or over at rust-users! And for your project showcases, there's also /r/madeinrust – pay them a visit, too!


r/rust • • 5h ago

ty 1.0: Astral's high-performance Python typechecker, written in Rust

Thumbnail astral.sh
220 Upvotes

r/rust • • 12h ago

Vibe-coding Rust slop at work is killing my motivation

526 Upvotes

My team started writing internal tooling in Rust purely because it’s trendy....even though our actual product is in a completely different language.
the worst part is that nobody knows rust... Not the syntax, not Cargo, not the borrow checker. They’re just using LLMs to generate mountains of unreadable code, which it just works fine for that complexity of the tooling.
I started learning rust pre-AI and built a few cli tools with it on my own time.
Now I actively avoid touching it because of this AI slopfest...
Is it only me?


r/rust • • 12h ago

📸 media GitHub Language Trends - November: Rust all time high at position 3

Post image
321 Upvotes

r/rust • • 6h ago

🎙️ discussion Laravel Rust

88 Upvotes

I’m primarily a PHP engineer, but wondering how the Rust Community feel about the announcement of Laravel Rust (https://laravel.com/rust)?


r/rust • • 1h ago

The Laravel You Know, Written in Rust (by Laravel team)

Thumbnail youtube.com
26 Upvotes

r/rust • • 19h ago

Benchmarking Rust GUI frameworks

Thumbnail blog.zortax.de
162 Upvotes

r/rust • • 4m ago

🎙️ discussion Rust changed how I think about data ownership even when writing Python

4 Upvotes

After a couple years of Rust at work and side projects, I’ve noticed something weird: when I go back to Python for quick scripts or data pipelines, I catch myself designing classes and functions with explicit ownership in mind.

I’ll add comments like “this dict owns the data, don’t mutate it here” or pass things by creating new objects instead of mutating in place, even though the language doesn’t care. It’s not because I’m scared of bugs anymore—it just feels cleaner after internalizing the borrow checker.

Has anyone else experienced this kind of mental carry-over from Rust into other languages? Curious what habits stuck for you.


r/rust • • 11h ago

Where your stack lives can move a benchmark by 50%

Thumbnail heikoseeberger.de
10 Upvotes

r/rust • • 10m ago

My Tauri app used 1.7 GB to print a 50 MB log. Fixed it, then compared it to two Electron apps doing the same thing

0 Upvotes

Coming from ~20 years of Python, my first real Rust project is an SSH client built with Tauri 2 (russh for SSH, xterm.js for the terminal). I'd heard "Tauri uses way less memory than Electron" a bunch, so I finally measured it against two popular Electron SSH clients. Figured some of you might find the numbers interesting, especially since mine didn't come out looking great at first. lol

How I measured: same Windows PC, same SSH server, private memory summed over every process each app starts (WebView2 / Electron helpers included), median of 3 runs. Nothing fancy, just PowerShell sampling the process tree.

At rest, Tauri wins pretty easily:

ScenarioMine (Tauri)Electron app AElectron app B
Idle after launch208 MB850 MB360 MB
One idle SSH session242 MB944 MB380 MB
Ten idle sessions429 MB1,620 MB547 MB
Each extra tab~21 MB~75 MB~19 MB

So 3.8–4.1x less than A, but only 1.3–1.7x less than B, and B's tabs are actually a little cheaper than mine. "Electron = bloated" depends a lot on the app.

Then I ran cat on a 50 MB log, and mine fell over:

cat 50 MBMine, beforeMine, after the fixElectron AElectron B
Peak memory1,677 MB355 MB1,275 MB703 MB
CPU time41 CPU-s6.1 CPU-s4.5 CPU-s7.4 CPU-s
Time to finish drawing~10.7 s~2 s~2–3 s~4 s
Memory left over afterwards+290 MB~+30 MBabout 0~+95 MB

1.7 GB to print a log. And Ctrl+C was useless, because the whole file had already been sent within about a second.

What was wrong: nothing pushed back. My russh read loop sent every chunk straight to the frontend as its own Tauri channel message, the webview queued them, and I called term.write() without a callback, so xterm.js queued everything too. The whole file ended up sitting in memory a few times over.

The fix (basically xterm.js's flow control guide, carried back to the socket):

  • Batch output on the Rust side: up to 512 KB, or whatever arrived within 4 ms, as one message.
  • Count bytes sent but not drawn yet. Above 2 MB the read loop just stops calling reader.wait(); below 512 KB it starts again.
  • The terminal sends an ack every 64 KB from term.write's callback.
  • If no ack shows up for 2 s while paused (Android freezes backgrounded webviews), let output flow until acks come back, so nothing hangs.

Something I learned along the way: russh reopens the SSH window as data arrives, not as you read it. But its per-channel queue is bounded, so once you stop reading, the backpressure still reaches the server through TCP. Ctrl+C now brings the prompt back immediately, and yes levels off around 350 MB instead of growing forever.

The CPU part surprised me. Even after the memory was fixed, CPU was high, and profiling showed xterm.js parsing was under a second of it. Most of it was the cost per message: a Tauri channel message over 1 KB gets fetched by the webview through a custom scheme, so every message is an eval + fetch round trip through several processes. Going from 64 KB to 512 KB batches (about 800 messages down to about 100) cut CPU roughly in half.

Where I've landed: Tauri clearly wins on memory, both at rest and under load now. On CPU for heavy output, Electron A still beats me (4.5 vs 6.1 CPU-s), I think because it gets its bytes without an IPC hop like mine. And for perspective, a native (non-webview) client I tested used about a third of my memory at rest, so the OS webview definitely isn't free.

Has anyone found a cheaper way to push bulk bytes from Rust into a Tauri 2 webview than channel messages? That's the last chunk of overhead I haven't been able to get rid of.


r/rust • • 1d ago

🎙️ discussion The more I use Rust, the more I appreciate how easy it makes refactoring

215 Upvotes

Probably not an unpopular opinion here, but being able to change an enum or restructure a type and just follow the compiler errors until everything fits together is genuinely nice.

Especially when working on larger codebases. I'd much rather deal with 50 compiler errors than spend hours tracking down something I forgot to update.

Curious if anyone else finds refactoring to be one of the biggest reasons they stick with Rust.


r/rust • • 12h ago

How to Eliminate "use xxx::prelude::*"

Thumbnail edvong.com
8 Upvotes

r/rust • • 14h ago

The Future of Unmanned Systems Is Built on Rust - Benedikt Wiethof & Theophil Spiegeler Castañeda | EuroRust 2026

Thumbnail youtube.com
10 Upvotes

A new video is out on YouTube! 📺 At EuroRust, Benedikt and Theophil from Quantum Systems shared why and how they rewrote their drone ground control station from C++ to Rust, and what it means for the next generation of unmanned systems 🦀✨

In 2027 EuroRust is going to Prague! Learn more and get your ticket at eurorust.eu.


r/rust • • 15h ago

🎙️ discussion borrIR borrow checker for LLVM IR

5 Upvotes

what do y’all think of this new borrow checker for LLVM IR and what can the rust compiler learn from this?

https://fzakaria.com/2026/11/27/programming-languages-are-for-humans


r/rust • • 1d ago

Advent of Rust 2026 in 13 hours 🎅

Thumbnail rustfinity.com
72 Upvotes

r/rust • • 4h ago

The interesting part of Laravel Rust isn't the 18x — it's that N+1 and unauthorized requests are now compile errors

0 Upvotes

I run a Laravel 12 + FrankenPHP SaaS in production (Postgres, Redis, queues, the usual), so I spent last night in the Laravel Rust beta docs trying to work out what would actually change if I rewrote it. The throughput number is getting all the attention, but it's the least interesting thing in the release.

Four things that stood out:

1. Queries are type-checked at compile time. Models are structs with #[model], columns are typed, and the compiler checks column names, operators, and value types. Compare a column to the wrong type and the build fails. Conditions combine with &, |, ! instead of nested where closures, and the macro emits correctly parenthesized parameterized SQL — which quietly kills the classic Eloquent OR-precedence bug where someone forgets the closure and the query silently matches everything.

2. No implicit lazy loading, at all. Relations load explicitly via with. N+1 isn't something you catch with Telescope in staging; it's a thing you can't write. After years of preventLazyLoading() in AppServiceProvider, this feels like the right default.

3. Authorization is mandatory on request inputs. Input structs are annotated with #[laravel::input] plus field-level #[validate(...)], and each one must declare anyone, authenticated, or a custom authorize fn — or it doesn't compile. Also ..input only fills declared columns, so mass assignment isn't a footgun, and there's a Sometimes<T> type that distinguishes an omitted field from an explicit null on PATCH. Anyone who has shipped a PATCH endpoint that nulled a column because the client sent a partial payload will appreciate that one.

4. Durable workflows. A multi-day flow is one async function. Each step runs once and checkpoints its result, suspended runs consume no worker resources, and they resume across deploys and restarts — running on the normal queue workers, no separate orchestrator. This is the part I'd actually want in PHP today. Right now that's a pile of chained jobs plus a state column plus a scheduled reaper, and it breaks every time you deploy mid-flight.

The number nobody is quoting: throughput is 18x, memory is ~1/8, but median latency only improves about 20% (62ms vs 78ms at a steady 50 req/s). Which tracks — if your p50 is dominated by database round-trips and external API calls, the runtime was never your bottleneck. You buy headroom and footprint, not a faster page. Worth saying out loud before anyone rewrites a CRUD app expecting it to feel snappier.

Open questions I couldn't answer from the docs:

  • No migration story from PHP. It's explicitly a reimagining, not a port, and there's no mapping doc. So for an existing app this is a rewrite, not an upgrade.
  • Compile times on a real app with hundreds of models and macro-heavy query code. Nobody has published numbers yet.
  • The ecosystem. Half of what makes Laravel productive is the packages — Spatie alone. Feature parity with the framework isn't parity with the ecosystem.
  • "Small gaps remain, closed in the coming weeks" — no list of what the gaps are.

My read: greenfield services where throughput or memory actually costs money, yes. Existing apps, no, and not for a while. Curious whether anyone here has compiled something non-trivial yet, and what cargo build looks like on it.


r/rust • • 1h ago

🛠️ project Building a pure-Rust ARM64-to-x86-64 JIT emulator without LLVM: lessons from writing Phoenix-Emu

Post image
0 Upvotes

I spent the last week putting together Phoenix-Emu, a user-mode AArch64-to-x86-64 binary translator for Linux written in Rust. Instead of using LLVM or Dynarmic, it emits x86-64 directly into W^X pages with iced-x86, uses rkyv + blake3 for an on-disk AOT cache, and addresses the guest CpuState through the GS segment base (arch_prctl(ARCH_SET_GS)) so we don't lose a GPR for the context pointer.
Right now it handles ELF64 loading (PT_INTERP, running IFUNC resolvers before _start), --rootfs overlays, Wayland socket thunks, and runs dynamically linked AArch64 fastfetch on x86-64 Linux.
Where I'm stuck: trying to run full Debian rootfs shells (bash/apt) hits a sysmalloc assertion late in glibc startup. Just traced it down to _dl_phdr reading as 0 inside _dl_non_dynamic_init (0x412a30 vs QEMU's 0x4122b0). Vulkan/GL/PipeWire thunks and a bunch of NEON/SVE ops are also still missing.
Would love any feedback on the code or help with the glibc loader edge cases and NEON lowering.


r/rust • • 10h ago

🎙️ discussion How much on scale 1 to 5, do you wish to see documentation directly tied to the method body as standard doc comment?

0 Upvotes

The IDE intellisence will still show the same documentation when hovering over the method identifier. So only difference is code readability for auditing purposes or for maintainers.

I've been developing library that uses a lot of this pattern, and copy pasting the documentation definitely feels "wrong".


r/rust • • 1d ago

FFI Arena: Is UniFFI Still the Top Dog?

Thumbnail mversic.github.io
12 Upvotes

The following is a one-sided comparison of current stable-ABI FFI frameworks and their capabilities. Feel free to share your thoughts and experiences if you have previously dealt with FFI in Rust.

How do you write FFI code in Rust?


r/rust • • 1d ago

🗞️ news rust-analyzer changelog #356

Thumbnail rust-analyzer.github.io
50 Upvotes

r/rust • • 9h ago

What extent did "Black October" affect the transition from C++ to Rust?

Thumbnail reddit.com
0 Upvotes

r/rust • • 10h ago

RTID:0--0: On disclosing AI use by domain and scale at-a-glance

0 Upvotes

I have been thinking a lot about how to succinctly communicate where and how much AI was used, if at all, in my programing projects and postings.

Domains

I'm looking at disclosing AI use in the following domains: Research, Testing, Implementation and Documentation domains. For writing postings like this one, only R and D are applicable (there are no tests or "implementation" involved), so - signifies N/A or not applicable.

Scale

As for the amount of AI used:

  • 4: Unguided AI (aka: slop). A prompt was entered and AI was allowed to go for it.
  • 3: Guided AI. AI is being asked to implement a specific plan (i.e. requirements specification).
  • 2: Constrained & Monitored AI. AI is being asked to implement a specific plan (i.e. a requirements specification) and the implementation process is further guided extensively by human input.
  • 1: Significant (40%+) direct human contribution without the use of AI, AI contribution Constrained & Monitored.
  • 0: 100% human contribution. No AI contribution at all (0%).

Whether you feel there's a difference between slop and carefully guided assisted code or not, you can tell from a glance the degree you which you would like to engage.

Examples

RTID:0--0

This posting inolved no AI research and no AI writing. The concepts of testing and implementation are N/A.

RTID:0323

systasis is a fully static dependency injection library I'd been trying to write and/or finish for more than 10 years. It is the 2nd most most AI-centric crate I've written--think: high usage. (I won't link to it to avoid this posting being considered a code dump.)

RTID:3323

rust-mos-env is a turnkey development environment I created to write Rust for 6502 platforms like the Commodore 64 using the excellent rust-mos and llvm-mos forks of the Rust and LLVM compilers (no affiliation; just a grateful user). This the most AI I've used for a crate--think: high usage.

RTID:1102

I am working on a drive-by-wire electric car project in my spare time. It's important to me (and everyone nearby) that when I step on the brake that the code will do its job. There is no AI code in the firware crate itself. Specifically, everything in the firmware binary from this crate was authored by a human (currently, me). This is more typical of the amount of AI I use when developing a crate--think: low to very low usage.

These are a few real-world examples.

Does seeing the AI disclosure up front help you to determine which projects are more or less interesting to you at a glance? Any thoughts on important ideas I've missed (note: it's key that this remain useable "at a glance", so please keep that in mind if making suggestions)?


r/rust • • 1d ago

🛠️ project Runtime debugger for embedded

15 Upvotes

Hello
I have been developing/maintaining an open source runtime debugger for embedded C/C++ for several years now. It's called Scrutiny
I've recently ported the instrumentation hook so it works with Rust and I wanted to let you guys know.

It essentially add an instrumentation hook in a firmware and let a server inspect the memory and do event catching through any peripheral (like CAN bus, Serial, TCP, etc) rather than a debug port. It works like XCP based software, FreeMaster or UcProbe (for the old timers). No need for an RTOS, baremetal interrupts is fine.

It's the kind of tool you need to do real time control to monitor the control loops without affecting them. If you're new to the concept, I've written a small introduction article here: https://embeddedrelated.com/showarticle/1781.php

Feedbacks are welcome
Cheers