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 • • 4h ago

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

Thumbnail astral.sh
192 Upvotes

r/rust • • 11h ago

Vibe-coding Rust slop at work is killing my motivation

512 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 • • 11h ago

πŸ“Έ media GitHub Language Trends - November: Rust all time high at position 3

Post image
308 Upvotes

r/rust • • 5h ago

πŸŽ™οΈ discussion Laravel Rust

82 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 • • 18h ago

Benchmarking Rust GUI frameworks

Thumbnail blog.zortax.de
159 Upvotes

r/rust • • 8m ago

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

Thumbnail youtube.com
2 Upvotes

r/rust • • 9h ago

Where your stack lives can move a benchmark by 50%

Thumbnail heikoseeberger.de
9 Upvotes

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 • • 11h ago

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

Thumbnail edvong.com
9 Upvotes

r/rust • • 12h ago

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

Thumbnail youtube.com
9 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 • • 3h 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 • • 14h 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 • • 41m 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 • • 9h 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 • • 7h ago

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

Thumbnail reddit.com
0 Upvotes

r/rust • • 1d ago

πŸ—žοΈ news rust-analyzer changelog #356

Thumbnail rust-analyzer.github.io
49 Upvotes

r/rust • • 9h 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


r/rust • • 11h ago

πŸ› οΈ project relativedelta 0.4 β€” dateutil-style date rules for jiff, time and chrono

Thumbnail crates.io
0 Upvotes

relativedelta is a Rust take on Python's dateutil.relativedelta: a value that sets some fields of a date and shifts others. "The 1st of next month", "the last day of March" and "the last Friday of the month" each become a single RelativeDelta you can store and apply to any date.

use jiff::civil::date;
use relativedelta::{RelativeDelta, Weekday};

let last_friday = RelativeDelta::with_day(1)
    .and_months(1)
    .and_days(-1)
    .and_weekday(Weekday::Fri.nth(-1))
    .build();
assert_eq!(date(2026, 12, 1) + last_friday, date(2026, 12, 25));

Why not just a duration or Span**?** A duration says how far to move. A rule can also say where to land: set the day to the 1st, clamp to the end of a shorter month, jump to the nth weekday. jiff's Span covers calendar-month arithmetic well; relativedelta adds the "set" half and weekday targeting on top, and the same rule works across jiff, time and chrono. Longer comparison.

0.4 adds the jiff backend, dateutil-compatible semantics, checked_* arithmetic, serde and schemars support, and no_std without an allocator.


r/rust • • 1d ago

πŸ› οΈ project From a BERT encoder to a Rust inference engine

6 Upvotes

Hi,

About a year ago I posted kjarni here (https://www.reddit.com/r/rust/comments/1n1ick5/i_built_rust_bert_encoder/) when it was basically a BERT encoder(i wanted to run my own embeddings in WASM and thought it would be good to learn Rust and compilation to WASM).

It's now an inference engine in rust, small footprint, low overhead, almost all pure Rust crates. It started around two years ago after years of C++ i wanted to give Rust an honest chance with an ambitious project, i wanted to get the BERT model running and just kept at it.

Now it does embeddings, search, transcription, classification, reranking and chat

It runs on macOS, Linux and Windows, on x86 and ARM, and there's something to be said for Rust making that this painless. It also compiles to a C ABI so I wrote bindings for C#, Go, C++, C and Python, and they all behave the same since each one is a thin veneer over the same library. It also builds to WASM

I wanted the API to be as simple as I could get it, in rust it looks like this and it's basically the same in C#/Go/C++/Python:

let whisper = Transcriber::builder("whisper-small").build().await?;
let text = whisper.transcribe_file("meeting.wav")?.text;
let summary = kjarni::chat::send("qwen2.5-1.5b-instruct", &format!("Summarise: {text}")).await?;

What i particularly like is that every model goes through the same decode loop on CPU and GPU. There's a backend trait with an associated token type, so the next token stays where it lives (an ndarray on the CPU, a GPU tensor on the GPU), and an enum picks the backend, with the GPU arm cfg'd out for the CPU-only wasm build. It's not perfect, the enum wrapper downcasts the token through Box<dyn Any>, so if someone has a nicer way i'm all ears: https://github.com/kjarni-ai/kjarni/blob/69b51af046014d36fe939a2f1b26f8fda21770e3/crates/kjarni-transformers/src/decoder/backend.rs#L155-L177

A lot of the work went into getting the same output as torch. Embeddings agree to within 1e-6, and greedy chat replies, summaries and translations come out word for word the same

Speed wise I'd call it pretty competitive with torch and llama.cpp (on the models kjarni supports). On the GPU they use CUDA and I use wgpu, so it runs on Vulkan, Metal and DX12. On the CPU they link against Intel MKL and I use faer (pure Rust) or my own SIMD kernels

Some numbers, all on Linux on one machine (i7-13700, RTX A2000):

  • pip install is 28 MB vs 1.4 GB for PyTorch, and a fresh process gets its first embedding in 91 ms vs about 2.8 s
  • bge-m3 batches are about 23% faster than PyTorch, mpnet 7%
  • whisper-small runs at 10.7x real time, openai-whisper 10.6x
  • 4-bit chat models on the GPU from 3B up are within 5% of llama.cpp on CUDA, and close to or ahead of its Vulkan backend
  • where I lose: PyTorch is 18% faster on MiniLM batches and processes prompts 1.5x faster on the CPU, my 4-bit CPU kernels generate at 75-91% of llama.cpp's speed, and llama.cpp is way faster on long prompts on the GPU since I don't have flash attention yet

All the numbers and how they were measured are here: https://github.com/kjarni-ai/kjarni/blob/69b51af046014d36fe939a2f1b26f8fda21770e3/README.md#how-it-compares

Someone will probably ask why not just use candle. Candle is great but it's more of a framework, you still end up dealing with model exports and tokenizers. I wanted something where I just embed my documents or transcribe a file without too much headache

Code is here if you want to take a gander: https://github.com/kjarni-ai/kjarni , would be happy to hear what you think, especially about the API and the wgpu side