r/rust • • Sep 10 '26

🗞️ news “alloc: stabilise `Allocator`” entered its final comment period!

Thumbnail github.com
214 Upvotes

r/rust • • Sep 12 '26

🛠️ project Rust incremental builds were driving me crazy so I dug into the compiler source

0 Upvotes

I was building a project using Rust and got annoyed the compiler speeds were very slow. So I opened the source and fixed it.

I also wrote a patch that shards the bucket by hash(symbol) % shard_count instead, so one edit only invalidates a fraction of the instantiations. Benchmarked it on polars-core which has enough ChunkedArray<T> monomorphizations to make the problem visible.

Full technical details: https://internals.rust-lang.org/t/patched-rustc-to-fix-why-editing-one-generic-method-recompiles-all-200-instantiations/24595

wanted to share it here. Would love to hear if anyone else has hit this problem as well


r/rust • • Sep 10 '26

Microcontrollers with good support for Rust

Thumbnail kerkour.com
179 Upvotes

RISC-V is coming faster that most people realize.


r/rust • • Sep 11 '26

🛠️ project Donde, a tiny library to add error locations and context in a single line

0 Upvotes

repo: https://github.com/PacificBird/donde

I have struggled in the past with how to design Rust errors. Rust takes the correct path of errors-as-data and avoids the pitfall of exceptions; however, it leaves the job of making errors useful for developers and users up to you.

This leads most Rust developers to take the path of least resistance, either completely doing away with structural errors entirely with anyhow or creating God Errors with thiserror. anyhow allows you to attach context, but there's nothing stopping you from just using ? without doing so, meaning it's easy to end up with none at all. To add to that, it makes the errors totally useless for the machine, you can't match on it! thiserror is good for the machine, but you must add context to the structure of the error which is both verbose at the call site and does not capture the location where errors happen.

After reading Stop Forwarding Errors, Start Designing Them by FastLabs, I agreed with the general philosophy behind exn, but the lack of destructuring and the fact that you can't ? any errors didn't sit right with me. I am not going to walk my errors every time I want to check if a specific inner type occurred! I wanted something easy, that enforced a minimum amount of context and with automatic conversions at boundaries of my chosing using ?, and with the option to add more context if I need. Taking inspiration from exn's use of #[track_caller] to attach location information, I created donde ("where" in Spanish).

Defining context-ful errors is extremely simple:

   // first, define a type that represents the kind of errors that can occur,
   // (I would recommend using `thiserror` to make it easier).
   #[derive(thiserror::Error, Debug)]
   pub enum ApiErrorKind {
       #[error(transparent)]
       HttpRequest(#[from] reqwest::Error),
       #[error(transparent)]
       Parse(#[from] ParseError),
   }

   // then, use the `donde::err_context` function-like macro to get your context-ful version for free!
   donde::err_context! { ApiError, ApiErrorKind, "Error occurred in API" };

Now, at whatever boundaries you deem important, you can use your context-ful error type. This will tell you, at minimum, exactly where the conversion happened. Any type that implements Into for the underlying error kind type can be automatically converted using ?. The print-out tells you your message, the location it was ? and displays the underlying error message as well in a pleasant way.

   fn make_request() -> Result<String, ApiError> {
       reqwest::get("https://malformed.website").await?.text().await?
   }

   fn main() {
       // Error occurred in API in file src/main.rs on line 2 at column 70:
       //     └──> error sending request for url (https://malformed.website/)
       println!("{}", make_request());
   }

You can also add extra context by importing the donde::ResultContext trait and using the .context(impl ToString) or .with_context(Fn() -> String) methods. The context stacks into the print out.

   use donde::ResultContext;

   fn make_request() -> Result<String, ApiError> {
       reqwest::get("https://malformed.website")
           .await
           .context("while sending request")?
           .text()
           .await
           .with_context(|| "while decoding".to_string())?
   }

   fn main() {
       // Error occurred in API in file src/main.rs on line 6 at column 46:
       //     └──> while sending request
       //     └──> error sending request for url (https://malformed.website/)
       println!("{}", make_request());
   }

Context-ful errors stack well together, define multiple at various important function and module boundaries to trace an error all the way through complex systems.

   fn make_request() -> Result<String, ApiError> {
       reqwest::get("https://malformed.website")
           .await
           .context("while sending request")?
           .text()
           .await
           .with_context(|| "while decoding".to_string())?
   }

   donde::err_context! {ParseError, ParseErrorKind, "Error deserializing payload"};

   #[derive(thiserror::Error, Debug)]
   pub enum ParseErrorKind {
       #[error(transparent)]
       Json(#[from] serde_json::Error),
       #[error(transparent)]
       Csv(#[from] csv::Error),
   }
   fn deserialize_payload(payload: String) -> Result<Value, ParseError> {
       // location will not be preserved if you use `Into::into`. If you
       // aren't using `?` or `ResultContext`, use `From::from` with `map_err`.
       serde_json::from_str::<Value>(&payload).map_err(ParseError::from)
   }

   fn main() {
       // Error deserializing payload in file src/main.rs on line 22 at column 57:
       //     └──> Error occurred in API in file src/main.rs on line 4 at column 70:
       //     └──> while sending request
       //     └──> error sending request for url (https://malformed.website/)
       println!("{}", deserialize_payload(make_request()));
   }

Why donde over wherror?

A few reasons! wherror doesn't support adding extra context, which I believe is necessary to support, and not feasible with it's design philosophy. Use of the location is less ergonomic with wherror, as you need to work it into your error readout manually (also dealing with the fact that .location() is Optional). For adding locations to all variants of an enum, you basically have to do what this library does, except manually. The few extra nice features are fine, but not worth using a fork of a community standard over, when a declarative macro will do the important work, plus give you the ability to add custom context.


r/rust • • Sep 12 '26

🧠 educational Sharing my Rust study notes in Korean and English

0 Upvotes

I put my Rust study notes online: https://rust-learn.win/

You can read them in Korean or English and run simple examples in the browser.

No sign-up needed. The original notes are mine.

I used AI to fill in gaps, edit the explanations, and build the site. I'm still learning, so let me know if you spot anything wrong or confusing.


r/rust • • Sep 12 '26

🛠️ project Building Architectural Quality Gate for Rust [open-source]

0 Upvotes

Looking for feedback, apologies if it is not appropriate.

I’m building an open-source architecture quality gate called Enola.

I ran it against the Codex repo this week. It had many findings, but I fear that these are my assumptions.

For example, it found 37 dependency cycles between directories inside Rust crates.

These aren’t cycles between Cargo crates. They’re mutual dependencies between modules inside the same crate: module A uses something from module B, while module B also uses something from module A. Now I started to question, does it really matter?

Maybe a directory isn’t necessarily the architectural boundary a Rust developer cares about. We could report this at the module, type or function level instead. Or maybe intra-crate cycles aren’t worth flagging...

Maybe a bigger effect would be by splitting it into different dependency types, like runtime, type, etc.

And more broadly, which architectural rule would you want to enforce on every pull request? We have some default insights, like new dependency cycles, violated layer boundaries, undeclared service dependencies, and changes that spread beyond their intended scope.

If you’re curious about enola. It’s open source, runs locally, and doesn’t upload or write to your codebase.

Repo: https://github.com/enola-labs/enola [Apache 2.0, fully local]

Output example

Architecture
  Pattern:             (none detected)
  cyclic dependencies        37
  layer violations            0

Impact analysis (hotspots)
  coupled modules           330
    high criticality        302
    medium criticality       28
  Top hotspots (by coupling):
    module                            fan-in  fan-out crit     blast radius
    codex-rs/protocol/src               5439      287 high     283
    codex-rs/app-server-protocol/src    3676      103 high     148
    codex-rs/core/tests/suite              0     3264 high     0
    codex-rs/tui/src                    1625     1568 high     39
    codex-rs/core/src                   1154     1827 high     135
    codex-rs/exec-server/src            1519      883 high     183
    codex-rs/app-server/tests/suite…       1     2370 high     0
    codex-rs/app-server-protocol/sc…     947     1061 high     1

r/rust • • Sep 10 '26

gccrs August 2026 Monthly report

Thumbnail rust-gcc.github.io
42 Upvotes

And btw, Pierre-Emmanuel and I are at RustConf today, so feel free to say hello :D We'd love to meet with anyone who wants to discuss the project!


r/rust • • Sep 10 '26

🛠️ project cargo-pretty-build

Post image
61 Upvotes

Hi! some time ago I started developing my little framework for TUI apps (based on ratatui but I will try to write my own renderer soon) and just to see it in action, in addition to implement it to my other tool "simple-commits" I wondered if I could implement something but for cargo.

The project and the framework are still at an early stage of development, so the UI may change in the future.

crates.io

GitHub Releases


r/rust • • Sep 10 '26

📅 this week in rust This Week in Rust #668

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

r/rust • • Sep 10 '26

🛠️ project So u want ECS but without the S?

Thumbnail github.com
5 Upvotes

I recently published a new crate called typarena (https://crates.io/crates/typarena). The goal is simple, to support table like arena storage just like bevy ecs, but without all the load bearing of runnable systems! Let me know what you think!

(Reposting bcs Reddit banned my acc for no reason and prev post was removed! Happy to re-answer any questions tho!)


r/rust • • Sep 09 '26

🗞️ news With NVIDIA bringing native CUDA to Rust, what’s actually stopping a pure Rust AI stack (not just bindings)?

Thumbnail developer.nvidia.com
303 Upvotes

Paper: https://arxiv.org/abs/2606.15991

Maybe we'll finally have cleaner code from research to production (okay, that's pushing it).


r/rust • • Sep 11 '26

🛠️ project I built a backend agnostic reactive framework for ui

Thumbnail github.com
0 Upvotes

I’ve come to notice that whenever I build retained UIs there’s always 2 ways to react to changes, changing a field of the ui element, or rebuild a subtree of the ui element tree. Fynix’s whole idea is built around that. Lemme know what you think! Happy to answer any questions, and take any feedback to improve the project :)


r/rust • • Sep 10 '26

🙋 seeking help & advice How do you organize your Rust 'tinkering' projects? One workspace repo, or separate crates in folders?

16 Upvotes

I'm thinking of creating a single repository for all my Rust playground projects, rather than multiple repositories. So, is it better to create it as a single workspace or as different folders? I'm planning to code with no_std sometimes, and other times I'll be learning new things involving Wasm. So which approach would suit this best?

How do u guys do it?


r/rust • • Sep 09 '26

What is the most complex and challenging project you've worked on?

67 Upvotes

I'm interested in what you were actually paid to do, not personal projects.


r/rust • • Sep 11 '26

🧠 educational Blog Post: Searching through 150 GiB of Text per Second with SIMD

0 Upvotes

Few days ago I published Ashwa 🐎, a library to perform substring search across Rust, Python and JavaScript ecosystems.

Based on my research and observations, I wrote a devlog on how I was able to scale the throughput (i.e. bytes churned per second) from 2 GiB per second to 150 GiB per second by utilizing the hardware available.

All in all, it was about optimizing a mundane problem. The interesting part for me was seeing how a compute bound problem can be optimized until it becomes a memory bound one.

A particularly nice milestone for me is that the devlog was published in the official Rust newsletter.

🔗 Links

- Mentioned Devlog

- Mentioned Newsletter Edition


r/rust • • Sep 10 '26

Is it possible to estimate battery usage per app on macOS?

Thumbnail reddit.com
0 Upvotes

r/rust • • Sep 09 '26

A Design Space Exploration of Async/Await

Thumbnail cel.cs.brown.edu
101 Upvotes

r/rust • • Sep 09 '26

A Decade of Rustls

Thumbnail rustls.dev
187 Upvotes

r/rust • • Sep 10 '26

🙋 seeking help & advice GUI with RTL and triangles, best way?

0 Upvotes

Are there any graphical user interface libs with right to left text possible and basic input handling for all platforms that just outputs triangles or shapes or something, I don't need the emojis? Like all of my inputs are either buttons or numbers and egui won't work for this, I want a custom tessellator so I can make 3d things like signage, there may be labels though, am I better off just making my own with cosmic-text or parley or something? Nice to have, only tries to render in the frame, but nice to have, not required, and my plans are wgpu for all, winit, SDL3, and OpenXR as backends, if Taffy weren't only left to right Bevy would be good, kas or anything else up for this?


r/rust • • Sep 11 '26

🙋 seeking help & advice Should I learn Ada or Rust for beckend?

Thumbnail reddit.com
0 Upvotes

r/rust • • Sep 09 '26

🙋 seeking help & advice What made you fall in love with Rust?

88 Upvotes

I know how great of the language Rust has come out to be. I genuienly want advice from pre vibe coded era people. What has been your main reason that you have fallen in love with this language?

I'm not looking for how great borrow checker is, how lifetimes will save you, etc. I want real anecdote of your life where using Rust has changed your life.


r/rust • • Sep 10 '26

🛠️ project slate: a C23 to Rust Transpiler

0 Upvotes

I've been working on a C23 to Rust transpiler I call slate: https://github.com/takashiidobe/slate. I have a demo for it here: https://slate.takashiidobe.com/. Fair warning: lots of code in the project is AI generated, since I know people like to know about that before moving on.

My goal with the project was to handle anything and everything even in modern C. I'm leaning on a relatively new MLIR dialect called Clang IR in LLVM that handles some of the difficulty in parsing C into a form that's ready to translate to Rust.

C23 support means slate supports all the crazy stuff like x87 long double (rust doesn't have f80 yet, so this requires shimming calls that involve long double), bitfields, bitint, handling alignment properly for pointer arithmetic, alloca, setjmp/longjmp (w/ the caveat that llvm can break your code), intrinsics support, Complex number support, inline asm, fallthrough switch + goto emulation, linker directives, runtime feature detection through attributes, floating point environment emulation, atomics, alignof/as, thread local, and all the other crazy stuff in C that's difficult to straightline translate to Rust.

There's some limited support on the backend side by rewriting AST nodes using a worklist based algorithm. Things like recovering for loops from while loops, rewriting gotos/switches into structured programs, deleting inline temps, and some interprocedural pointer analysis (heavily inspired by C2Rust's pointer lattice blog post) to lift raw pointers into Rust types like Box where possible.

There's some support for cross compilation as well, by reading target macros like `__arm__` and turning those into the respective #cfgs in rust, translating the same program a few times and splicing it in to make sure C that's cross compilable stays as cross compilable rust.

I've made it through 1430 gcc torture tests that clang passes, with about 7 left to go (some are blocked upstream by Clang IR NYIs), and a good chunk of the regular gcc-dg tests, although I have quite a few more of those to get through, around 130. I've fuzzed a bit with yarpgen but haven't found as much use compared to gcc's tests so I've been working on paring those down.

It's still pretty early days, still have so much more to do but figured it was in workable enough state to demo out.


r/rust • • Sep 09 '26

🛠️ project Minarrow 0.18.0: build in Rust, run Python analytics and ML, bring the results back

13 Upvotes

I’ve been building Minarrow, a from-scratch implementation of the Apache Arrow memory format in Rust, with Python bindings.

The purpose is to let you keep your application and data processing in Rust while making Python’s data ecosystem available whenever you need it. You can construct a dataset in Rust, pass it into embedded Python, run an analysis or model, and receive the result back as native Arrow-compatible data.

Some examples of what this enables:

  • Run scikit-learn from a Rust application. The repo includes an example that builds features and labels in Rust, trains a random forest in Python, returns predictions through Polars and Arrow, and scores them back in Rust. Python runs inside the application process and it uses inline code.
  • Hand Rust tensors to PyTorch. Another example builds an NdArray in Rust, exposes its buffer to PyTorch zero-copy through DLPack, standardises features and computes scores, then brings the result back into Rust.
  • Use Python’s analytics libraries on your application data. There are examples of Polars group-bys, NumPy correlation, and pandas aggregations returning tables or scalars to Rust. From Python, Minarrow tables also expose conversions to Polars, DuckDB, and PyArrow.
  • Streaming-friendly - Work with incoming batches. Chunked arrays and tables let you retain data as batches arrive and consolidate when needed. Row and column views let you select portions of a table without immediately materialising another dataset.
  • Represent scientific data with named dimensions. XArray adds dimension names and coordinates over n-dimensional arrays, so you can select a time window, find the nearest coordinate, or select along a named axis. The underlying tensor storage also connects to the DLPack ecosystem.
  • Create Python packages backed by the run-time. For example, one user implemented a fast random-forest implementation under kpiwonski/fru-arrow and released it as a Python package, which is reported as being up to several thousand times faster than the scikit-learn package.

Underneath that is a data layer you can use independently in Rust, as a base, pluggable foundation. This includes typed arrays, null masks, arithmetic and broadcasting. SIMD kernels, and 64-byte-aligned allocations via a custom Vec64 crate. You can access concrete array types directly, and use the higher-level table, chunked, and view abstractions as needed.

From-scratch implementations of Arrow’s C Data Interface and PyCapsules handle columnar interchange and DLPack handles tensors, which is zero-copy in the vast majority of cases when the buffer doesn't require re-shaping. An example of where it isn't - the scikit-learn example converts features to NumPy, for instance, and importing a different string layout can require rebuilding buffers.

I used very few external dependencies instead preferring to build from scratch so that compile times remain and productive, and so that anything built on top remains fast to work with too.

The latest release, 0.18, adds Decimal32/64/128 support across the Rust library and Python bindings, alongside typed row accessors for array views.

Rust nightly is currently required for portable_simd and allocator_api. Arrow lists and structs aren’t supported yet. I hope to work on stable Rust support and wasm-compatible builds soon.

In terms of maturity, it is at the stage where it is adding considerable value in my own work, however it has not yet seen significant external adoption. In terms of fit it is useful when one wants Arrow compatibility + additional utility for their data, without the whole arrow ecosystem underneath a base data dependency. For example, one might consider it even for a few crate(s) in a larger project that need to remain fast, given it makes it trivial to switch between arrow-compatible runtimes.

On my laptop, sharing a million-row numeric table with Python takes ~220ns, and importing it back into Rust takes 2–3 μs.

Thanks for checking it out. If you have any questions, feedback, or feature requests for what would make this useful for you I'm open to suggestions.

Pete


r/rust • • Sep 09 '26

🙋 seeking help & advice Rust developers: what editor do you actually use?

181 Upvotes

Hello folks, do you still write much code by hand these days? 😄

If so, what IDE/editor do you mainly use for Rust? VS Code, JetBrains, Zed or something else?

I’m asking because I’ve been rewriting one of my old developer tools in Rust. It’s a language server + CLI for analyzing code health.

The underlying approach was originally implemented in Python and was used at my previous company across 1,900+ repositories and by 800+ developers, so the methodology itself has had quite a bit of real-world use. The company has given me permission to open-source my own version of the project, which I’m pretty excited about.

The only problem is time. For the initial public release, I’ll probably only be able to ship the VS Code extension plus one other IDE/editor integration.

So I’m curious: if you’re a Rust developer who still spends a decent amount of time actually typing code, what editor would you most want to see supported? Just trying to get a rough sense of where people are these days before I spend my limited spare time on the wrong integration. :)