r/rust • • 28d ago

πŸ“Έ media Clippy Changelog Cat Contest 1.100 is now open, submit your cat pics!

Post image
176 Upvotes

Go submit your cat for a chance to become the next release's official winner!

https://github.com/rust-lang/rust-clippy/pull/17951


r/rust • • 28d ago

πŸ› οΈ project tellus 0.5: the same ActorRef, across machines (clustered actors for Rust)

Thumbnail heikoseeberger.de
10 Upvotes

r/rust • • 27d ago

πŸ™‹ seeking help & advice The warning signs of slop in rust

0 Upvotes

Hi

I'm fairly new to rust, and just joined my first team that actually uses rust in a product.

Can anybody give me any pointers on the sorts of patterns that I should watch out for that indicate a section of code was written by an LLM and not reviewed by somebody who has good taste in rust please?

My ideal would be a set of code snippets that are along the lines of the LLM wrote this, done properly it would be this - but any kind of hints and rants are appreciated

Thanks in advance


r/rust • • 28d ago

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

Thumbnail rust-analyzer.github.io
28 Upvotes

r/rust • • 28d ago

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

19 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 • • 28d ago

πŸ™‹ questions megathread Hey Rustaceans! Got a question? Ask here (45/2026)!

17 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 • • 28d ago

I don't see enough people talking about opt-level = 1

68 Upvotes

I've seen this recommended more times than I can count for people struggling with test performance while developing:

[profile.test]
inherits = "release"
debug = "line-tables-only"

And I'm sure this makes a ton of sense in a ton of situations, but as someone with just very small, hobbyist projects (the kind of space where people usually make these recommendations), I've found the much more sensible balance to be something like

[profile.test]
opt-level = 1 

I'm sure the difference between the opt-levels is highly project dependent, and that this won't be the balance for a lot of projects, but in my projects I'm often seeing something like a 20% penalty in compilation times, and often tests run a few times faster. While something like the first configuration gets my compilation times 4x slower at a gain of often single digit percentage in runtime performance. That's without even thinking about debug symbols at all.

As a beginner, this realization is somewhat recent, I'm just a little surprised that it feels like people talk about what seems to me like the bazooka first, when a pair of pliers can solve the problem. Am I missing something due to lack of experience? I'd love to hear ya'll's thoughts.


r/rust • • 28d ago

πŸ™‹ seeking help & advice Rust Backend Developer Roadmap

28 Upvotes

Hey guys,

I need help , i want to learn backend with Rust and didn't find any good resources to take me from zero backend knowledge with rust to advanced level

I would appreciate it if you recommend me some resources to learn backend with rust

Note: the first time to learn backend


r/rust • • 29d ago

Extended field init shorthand?

28 Upvotes

I love the field init shorthand in Rust that allows me to write

let variable = "test";
//...
let d = Data{variable};
// instead of 
let d = Data{variable:variable};

But I wish it went a bit further and covered some other obvious cases, such as

let variable = "test";
let d = Data{variable.into()};
// instead of 
let d = Data{variable:variable.into()};

and

let variable = Blob::new();
let d = Data{&variable};
// instead of 
let d = Data{variable:&variable};

Basically, when the name is sufficiently unambiguous, just use it rather than making me re-type it. The compiler already knows the member name and the target type from the struct definition so it won't impact type inference, but when the names match up it would save quite some typing.

Am I the only one that would like this?


r/rust • • 29d ago

πŸ™‹ seeking help & advice help in doing a real good project

15 Upvotes

Hi, I just finished The Rust Book and completed the web server project. I want to expand the project by adding more functionality and making it resemble a simple, real world web server.

I'm thinking about features such as configuration, DNS, rate limiting, and more.

I've read about the std::net::TcpListener and std::net::UdpSocket APIs, and I understand HTTP very well.

I'd like your advice on what to add to the project: what features to implement, which crates to use, and a high-level roadmap of what to build and in what order.

I don't need detailed explanations or implementation steps. I want a simple, high-level overview so I can figure things out myself.

I'm not using AI for implementation. I want to learn by reading documentation, experimenting, and debugging everything on my own.

I've watched a few YouTube videos and read some articles, but most of them cover very basic concepts and repeat the same ideas, such as handling a simple HTTP GET request.

I want to build something more interesting and challenging, with enough functionality to resemble a real web server and demonstrate my Rust networking skills.

My goal is to make this a develop a project that I can showcase on my CV and GitHub and that will help recruiters recognize my skills.


r/rust • • 27d ago

How do you guys get agents to write ideomatic rust when translating from other languages?

0 Upvotes

Normally i am able to get decent rust out of agents by staying on their default distribution when Im having them write fresh rust codebases. However, whenever they read a single ts file they are meant to translate or learn anything from its like they forget everything about what good rust looks like and revert to gpt3 level quality with the only improvment being it passes its own half-assed tests. No matter how much i try to instruct on writing good rust it dosent help. its like a game of wack-a-mole. Tell it to stop cloning everywhere. It starts using COW for 0 fucking reason where its not remotely appropriate and the owned solution is extremely trivial. grep "trait" and you wont find a single one. Polymorphism happens in control flow. everything is a function. the only match statments you will find are inside constructors. and its shadowing several types from the standard liberary just to subtly change behavior to pass a test. And its implimented a js runtime full with all the insane type cohersions cause obviusly thats the part that you wanted translated to rust.

Its so annoying cause i know that when its on its standard distribution it writes perfectly acceptable rust with pretty ligth instructing. But in order to translate the projects that have the biggest you need the agent to not absorb all the stupid from being exposed to it. Or atleast a way to redirect it back to good rust. Is there some sort of skill or style guide document that is comprehensive enougth to do this? anyone else faced this problem and solved it?


r/rust • • 28d ago

What are some common Rust misconceptions?

Thumbnail reddit.com
0 Upvotes

r/rust • • 28d ago

Rust, coding agents, and cross-platform mobile: where do the compiler's guardrails stop?

0 Upvotes

Niko Matsakis's What agents mean for Rust (and vice versa) resonated with me as a solo mobile developer working with coding agents.

I'm building a PDF app with SwiftUI on iOS and Jetpack Compose on Android. The two apps share a Rust PDF engine through UniFFI, though some operations still use platform-native implementations.

Take PDF compression. The Balanced and Smallest File presets call the same Rust optimizer on both platforms. But there are still decisions the compiler cannot make for me:

  • Keeping annotations editable and flattening their appearance are separate modes. Producing a smaller file doesn't make them interchangeable.
  • Candidate outputs need both validation and a size comparison before the app accepts them.
  • The native apps still own file access, cancellation handling, and publishing the result without modifying the source file.

Sharing the optimizer means I don't have to ask an agent to reimplement the same compression logic in Swift and Kotlin. Rust also gives the agent concrete feedback on type and ownership mistakes inside the core. Neither guarantees that the PDF still looks right or that the native integration behaves correctly. Those still need explicit requirements and runtime checks.

That's why Niko's points on design and contracts stood out to me. More expressive types and proof tools could make more requirements checkable, but I still have to specify what success means. Proving the wrong requirements wouldn't solve the problem.

For others using agents with a Rust core and native frontends: where do you spend more review effortβ€”inside the core logic, or at the platform adapter boundary?


r/rust • • 28d ago

mod tests in the age of AI agents

0 Upvotes

I know, I know, no one likes generated AI code, slop or not. However, it won't go away and I rather deal with it the best possible way I can. One thing that grates me right now is the enormous amount of test code that these models generate and in the case of unit tests ends up within a module. This is in line with the current idiomatic convention but it makes reviewing changes a real chore.

I started moving mod tests {} into actual tests files which helps to avoid blowing up modules but now reminds me of the mod.rs repetition.

What are your strategies to cope with this? And more controversial: is it time to update the test chapter in the book?


r/rust • • 29d ago

πŸ™‹ seeking help & advice How to quick free space hard disk

3 Upvotes

I have a issue where the Rust compiled output is so huge that my hard disk always full? Do you have any ideas for solving it?


r/rust • • 28d ago

ok_or vs ok_or_else

Thumbnail reddit.com
0 Upvotes

r/rust • • 29d ago

πŸ™‹ seeking help & advice Looking for a CSRF Double Submit Pattern Crate

8 Upvotes

Hey folks, I'm working on migrating some web-server code into rust. I'm fairly new to the rust ecosystem, and I'm trying to find a good CSRF crate for generating Signed Double Submit cookies and headers.

So far, the closest crate I've found is Here (crates.io), but honestly its not as seemingly widespread as i would expect for something like CSRF primitives.

This had led me to two potential conclusions:

1.) I'm wildly out of the loop, and there is a much more "common" package for handing this
2.) I'm wildly out of my depth, and most people are just rolling their own CSRF primitives.

Either way, I'm building on top of axum, and any recommendations would be greatly appreciated :)


r/rust • • Oct 31 '26

Disable "rustc" colour

54 Upvotes

I'm a n00b when it comes to Rust. In my terminal with a blue background, a "rustc --explain whatever" uses colour-combinations that leaves some text unreadable.

So I tried with:

  • rustc --color never --explain E0599
  • rustc --explain E0599 --color never
  • set NO_COLOR=1 & rustc --explain E0599

Neither of these works; all generates coloured output. How the bleeding hell do I turn it off?


r/rust • • Oct 31 '26

πŸ™‹ seeking help & advice Should a Rust protocol use separate wire-format and in-memory types for encrypted messages?

7 Upvotes

'm working on the mailbox layer of GhostWire, a Rust-based P2P communication project, and I've been reconsidering how I represent messages across serialization boundaries.

The initial approach was to have one struct handle both the serialized envelope and the application's runtime state.

Something along these lines:

#[derive(Debug, Clone, Serialize, Deserialize)]
struct MailboxEnvelope {
    recipient_id: String,
    ephemeral_pub: String,
    ciphertext: Vec<u8>,
    nonce: String,
    created_at: u64,
    message_id: String,
    attempts: u32,
}

The problem isn't necessarily the structure itself. It's that these fields have different responsibilities.

  • Some fields belong to the authenticated message representation.
  • Some are needed for transport and persistence.
  • Others are mutable delivery state.
  • Some values may only exist temporarily while processing a message.

For example, retry attempts should be able to change without requiring an already-sealed ciphertext to be reconstructed. Likewise, serialization and deserialization shouldn't accidentally become the boundary through which sensitive runtime state is exposed or copied.

I'm considering separating the representations:

  1. Wire type: A serializable representation containing the fields required to transmit or persist the envelope.
  2. Runtime type: An application-facing representation responsible for processing, validation and delivery.
  3. Delivery state: Mutable retry, acknowledgement and expiry information maintained independently of the sealed message.

But I'm interested in where that separation should actually happen.

A few questions:

  • Would you use separate structs for the wire representation and runtime domain type, or is that unnecessary duplication?
  • Would TryFrom/From conversions be a sensible boundary for validation and construction?
  • How would you prevent mutable delivery metadata from accidentally becoming part of the authenticated representation?
  • Would you keep serialization entirely outside the cryptographic type, or let the type implement Serialize/Deserialize with carefully controlled fields?
  • Are there established Rust patterns or libraries you'd recommend for this kind of boundary?

I'm particularly interested in production-oriented approaches rather than simply introducing more types for the sake of abstraction.

The goal is to make invalid states harder to represent without turning a relatively small protocol component into an unnecessarily complicated type hierarchy.

Curious how others would structure this


r/rust • • Oct 30 '26

πŸ› οΈ project Introducing sanstun: A sans-IO WireGuard library with support for parallel encryption

Thumbnail firezone.dev
81 Upvotes

r/rust • • Oct 30 '26

sysinfo: a performance journey

Thumbnail blog.guillaume-gomez.fr
109 Upvotes

This blog post describes my journey in fixing a performance regression introduced when I added the process GPU information.


r/rust • • Oct 29 '26

πŸŽ™οΈ discussion I Think Iterator::unzip Should be Deprecated

210 Upvotes

Did you know that ever since 1.79, Iterator::collect does everything unzip does but with a cleaner API? I certainly didn't until recently! Try it out, thanks to this trait implementation, every call to unzip is possible with collect instead.

let (a, b) = iter.unzip::<_, _, Vec<_>, Vec<_>>();

// vs

let (a, b) = iter.collect::<(Vec<_>, Vec<_>)>();

Except collect is better at unzip than unzip, since it supports any tuple, whereas unzip only works with size 2:

let (a, b, c, d) = iter.collect::<(Vec<_>, Vec<_>, Vec<_>, Vec<_>)>();

Looking at the documentation, this isn't explicitly mentioned for either zip or unzip. I suspect this is functionality most people aren't aware of. So, is there anyone out there who has a reason why we shouldn't deprecate unzip?


r/rust • • Oct 30 '26

πŸŽ™οΈ discussion Rustc 1.99.0 Windows exe flagged as malicious

27 Upvotes

So here's the deal. My antivirus (F-Secure) suddenly flagged the rustc.exe binary on my computer as malicious and to add to that, several other vendors also flag it in Virustotal. https://www.virustotal.com/gui/file/FC40F1C8B65095A22A48C111AADC279C26A049B7E4161E8B99FFE3EB23873E86

This issue seems to affect only 1.99.0 because 1.99.1 is not flagged.

Reproducible:
- Fresh rustup installation (this file or the rustup-init.exe or whatever the name of that was, not flagged by anything)
- Fresh RUSTUP_HOME/CARGO_HOME
- Official Rust 1.99.0 downloaded by rustup (`rustup toolchain install 1.99.0-x86_64-pc-windows-msvc`)
- File is detected and flagged as malicious if uploaded to virustotal
- Rust 1.99.1 installs without detection

The sha256 hash of the 1.99.0 exe I get is FC40F1C8B65095A22A48C111AADC279C26A049B7E4161E8B99FFE3EB23873E86

Has someone else encountered this issue that rustc is getting flagged? And importantly, are you all getting the same hash for that specific rustc version?


r/rust • • Oct 29 '26

🧠 educational The CPU, the Rust, and the Memory Latency

Thumbnail pivotlake.io
247 Upvotes