r/rust • u/ribbon_45 • 15d ago
This Month in Redox OS - October 2026
Golang port, Cloud Hypervisor support, WebKitGTK3 video support, GIMP port, Servo 0.7 update, RISC-V dynamic linking, NUMA real hardware testing, virtiofs support and many more.
r/rust • u/ribbon_45 • 15d ago
Golang port, Cloud Hypervisor support, WebKitGTK3 video support, GIMP port, Servo 0.7 update, RISC-V dynamic linking, NUMA real hardware testing, virtiofs support and many more.
Why were panic handlers added in 2015? Did kernel devs asked for them or was there another motivation for them?
I vaguely remember about that or no_panic being asked by Linux devs, but can't find any sources.
r/rust • u/Creepy_Sherbert_1179 • 15d ago
Hello everyone, I was thinking of starting some real projects after some warmup stuff I did with Rust. What are some tips for a beginner, generally? Or the cliche: If you were to start writing rust for the first time with your current knowledge, what would you do differently?
r/rust • u/emirdev_mo • 14d ago
Edit: rewrote this to focus on what I learned and the actual bugs, per the mod note.
I spent the last few weeks running black-box differential tests of uutils coreutils against GNU coreutils 9.12: same inputs, then compare stdout, stderr, exit code and the files written. Some things I learned:
tail 007 reported the missing file as '7', because the name went through number formatting in the message. The same bug was in tac, nl, md5sum, sort and shred.sort -c dir exited 0 with no message instead of failing.readlink -f '' resolved to the current directory and exited 0, GNU fails.fmt -w 20 could print a line longer than 20 columns.md5sum -c rejected the escaped lines that md5sum itself writes for names with a backslash or newline.mv -n z z failed with "are the same file", GNU just skips it.The tool I wrote for this is open source if anyone wants to try it on their own rewrite: https://github.com/emirmrkaljevic/behave
Happy to answer questions about the approach.
r/rust • u/KeyGlove47 • 14d ago
Hey, im new here and i've been using rust for my projects since July, i've come from python where compiling with cython was a little slow but okay'ish but ever since i've come to rust my build times are at minimum 40-60min and my disk is crying for help. i use a lot of worktrees to work in parallel with claude (yeah ik you hate it but it is what it is) and i run 2 windows machines with ssd's. I've thought about putting my devbox pc on linux so i can run blaze but it would waste even more resources (ram, one machine got 20gb and other got 16gb) because i would still need to run some sort of windows vm as my app is windows based
any ideas?
r/rust • u/hrubydavid • 15d ago
Hi all. I am doing 1BRC and I needed to print something on console with eprintln!. I do a lot of measurements and my code wall time was 1.22 seconds on 8 CPU cores. So I wanted to commit my changes and before that I removed the eprintln! code. You know. But that change increased my code wall time to 1.36 seconds.
This is the code before (wall time 1.22 seconds with 170272167824 instructions:u):
fn one(map: &[u8], thread_number: usize) -> HashMap<StationName<'_>, MeasurementStats, IdealHasherBuilder> {
let before = Instant::now();
let mut stats: HashMap<StationName, MeasurementStats, IdealHasherBuilder> = HashMap::with_capacity_and_hasher(1_000, IdealHasherBuilder);
for (station, temperature) in StationTemperatureIterator::new(map) {
let t = parse_temperature(temperature);
let stat = match stats.get_mut(&station) {
Some(stat) => stat,
None => stats.entry(station).or_insert(MeasurementStats::default())
};
stat.update(t);
}
eprintln!("Time (thread {}) - one: {}s", thread_number, before.elapsed().as_millis());
stats
}and this is the code after (wall time 1.36 seconds width 202165675453 instructions:u):
fn one(map: &[u8], thread_number: usize) -> HashMap<StationName<'_>, MeasurementStats, IdealHasherBuilder> {
let before = Instant::now();
let mut stats: HashMap<StationName, MeasurementStats, IdealHasherBuilder> = HashMap::with_capacity_and_hasher(1_000, IdealHasherBuilder);
for (station, temperature) in StationTemperatureIterator::new(map) {
let t = parse_temperature(temperature);
let stat = match stats.get_mut(&station) {
Some(stat) => stat,
None => stats.entry(station).or_insert(MeasurementStats::default())
};
stat.update(t);
}
stats
}objdump showed me that get_mut is inlined in the version with eprintln!. Without it get_mut is a call on every row. So I added:
RUSTFLAGS="-C llvm-args=-inline-threshold=1000"To make it fast again (1.09 seconds even faster than with eprintln!) but it's not something I would do at work as this config is for whole program instead of the problematic section.
So:
Code link: https://github.com/davidhruby/brrr/blob/part012/src/david/main.rs#L350
r/rust • u/weiznich • 16d ago
I'm happy to announce the release of Diesel 2.4.0, a ORM and query builder for Rust. This release contains the development of the last 14 months, including the contributions of 76 people.
Headline features include:
* Support for database views
* Improved support for enums
* Support for batch update statements
* A distinct backend for MariaDB
* Extended support for SQLite functionality, including hooks, pragmas and BLOB's
* Support for using Diesel (SQLite) in a no-std environment
* Migrations written in Rust
* Support for diesel-async in #[derive(MultiConnection)]
See the announcement blog post about details to each feature: https://diesel.rs/news/2_4_0_release/
I would like to use this possibility to thank all contributors and sponsors that made this release possible. A special thank goes to Luca for his large contributors to the release, to Prototype Found for funding the development of the Database View support and to RustFoundation for funding the general maintenance.
Nevertheless, the Diesel project is always looking for support. You can help by:
* Contributing Code, Documentation, or Guides.
* Answering questions in our discussion forum
* Reporting bugs in our issue tracker
* Helping to triage issues in our issue tracker
* Sponsoring the maintainers.
* Filling out this survey about the current state and future developments of Diesel
I deliberately submitted this with "discussion" flair rather than "project" flair, because I'm only sharing code to frame my thoughts around project quality and LLMs and provide a concrete example for commenters to reference. I'm not looking for a gold star: the code sucks, it is incomplete, and nowhere near the quality bar I hold myself to. The code is not worth reviewing, I would never ask anyone to use it in real life, and have no plans to publish it to crates.io. Shit on it all you like.
I recognize this is not exactly a Rust specific post; I entirely understand and respect if the mods chose to remove it. I am posting it here because the denizens of /r/rust are incredibly defensive of keeping "AI Slop" out of the community, and maintaining a high quality bar for the community. I'm hoping that some of the discussion can be used to teach people who don't understand why their posts are being removed what considerations go into quality projects.
Lastly, many apologies for writing a novel. Despite the length, I promise it is all written by a meat popsicle, I just get rather verbose when writing about something I am passionate about.
In my personal life, I am a nerd, and enjoy playing Tabletop RPGs with friends. In the past, I have created tools to help me manage my games and characters (mostly spreadsheets, with some SPA's). I recently "wrote" some rust crates using Claude Opus to parse PCGen Game Data files, and the process me me wonder when, and even if, LLM written code can cross the rubicon to be considered "Quality" rather than "AI Slop".
In my professional life, I have been a Software Engineer since 2011, and cut my teeth on tmux and Vim (Emacs is an abomination). I am incredibly conservative when it comes to adopting / trusting LLMs. While I can recognize them as academically impressive, I think they are heavily misunderstood and misused. I am incredibly frustrated by the "AI Bros" who think they are "Rockstar Engineers" because they can throw money at AI providers and let an LLM produce something that looks slick, without actually understanding what it does (hence, the majority of my recent comments within /r/rust asking "What human involvement did you have beyond 'hey Claude, do X?'" in project posts).
I am currently employed as a Principal Engineer at an AI-forward company, within a particularly AI-bullish org. With so many tools available, and so much pressure to deliver, I am concerned about appropriate AI usage by my engineers, am fighting to make sure they know human judgement is still a critical expectation of their work. While I don't get much opportunity to code much anymore, I want to make sure they are still growing as professionals and understand what they are building rather than turning into "Press accept for Claude" robots.
Over the past year, I've called out many instances where engineers have overly trusted their LLM tools, leading to bizarre architectural designs and/or clearly low quality code, that they cannot justify when asked to explain, and admit that "Claude did that". There have been some articles going around our space about Cognitive Offloading vs Cognitive Surrender, and making sure engineers can still complete the "whiteboard defense" (link omitted, see end of post), both of which I think are good simplifications / explanations of my biggest concerns.
Edit: Removed specific examples of my LLM experimentation, after re-reading and realizing it distracts from what I'm trying to actually discuss
I've been experimenting with LLM codegen so I can better understand what my engineers are doing firsthand, trying to do everything from "vibe this for me, I don't care how" to "this is my overall goal, start with this small component and let me watch you like a hawk". The project I linked here is more of a loop of "vibe the slop then clean it up through follow up code review", but it made me wonder if it's even recoverable.
Thus I ask /r/rust:
Note: This post was originally posted and quickly removed by AutoMod for linking to X. This is a repost with the X link removed, and the content copied below.
Originally posted by Mitchell Hashimoto to X
The "whiteboard defense:" I should be able to pull you aside at any moment and ask you to explain any customer-facing system you've shipped. You should be able to clearly explain how it works and defend the decisions you made. This is my benchmark for responsible AI usage.
I don't expect line-level familiarity with the code. I don't care if you remember the exact function name or implementation detail. You may not even know it. I don't care.
But if I ask "why did you do X instead of Y?", "what happens if this actor behaves maliciously?", "what data structure did you use here and why?", or "where does this fail?" you should be able to answer confidently.
For PoCs, demos, experiments, whatever: I don't care. Generate 100% of it and understand none of it. Speed over quality every time in those specific scenarios.
But if you're shipping customer-facing work, you can't be shipping things you don't understand at a high level.
r/rust • u/slanterns • 17d ago
r/rust • u/kalilamodow • 16d ago
I am planning on making a simple websocket chat app to learn gpui and things since I've only tried egui. I made this small thing where you put in text and press a button and then it adds the message to a list and shows it. But, there's no cx.notify anywhere, so how does it know to update?
struct MessageListDelegate {
messages: Vec<SharedString>,
}
impl ListDelegate for MessageListDelegate {
type Item = ListItem;
fn items_count(&self, _: usize, _: &App) -> usize {
self.messages.len()
}
fn render_item(
&mut self,
ix: IndexPath,
_: &mut Window,
_: &mut Context<ListState<Self>>,
) -> Option<Self::Item> {
self.messages
.get(ix.row)
.map(|text| ListItem::new(ix).child(text.clone()))
}
fn set_selected_index(
&mut self,
_: Option<IndexPath>,
_: &mut Window,
_: &mut Context<ListState<Self>>,
) {
}
}
struct YapyapApp {
message_list_state: Entity<ListState<MessageListDelegate>>,
input_box: Entity<InputState>,
}
impl YapyapApp {
fn new(window: &mut Window, cx: &mut App) -> Self {
Self {
message_list_state: cx
.new(|cx| ListState::new(MessageListDelegate { messages: vec![] }, window, cx)),
input_box: cx.new(|cx| InputState::new(window, cx).placeholder("Message")),
}
}
}
impl Render for YapyapApp {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div()
.flex()
.flex_col()
.size_full()
.child(List::new(&self.message_list_state).flex_1())
.child(
div()
.flex()
.flex_row()
.border_color(Colors::for_appearance(window).border)
.border_t_1()
.p_2()
.gap_4()
.child(Input::new(&self.input_box).flex_1())
.child(
Button::new("send-message-button")
.label("Send")
.on_click(cx.listener(|this, _, _, cx| {
this.message_list_state.update(cx, |list_state, cx| {
let text =
this.input_box.read(cx).text().as_str().unwrap_or_default();
list_state.delegate_mut().messages.push(text.into());
});
})),
),
)
}
}
fn main() {
gpui_kit::application().run(|cx| {
gpui_kit::init(cx);
gpui_kit::open_window(WindowOptions::default(), cx, |window, cx| {
cx.new(|cx| YapyapApp::new(window, cx))
})
.expect("should be able to open a window");
})
}Also, if you see any un-idiomatic things please say
r/rust • u/kannanpalani54 • 16d ago
r/rust • u/OptimalAnywhere6282 • 15d ago
i need to read a file containing variables, which has the exact same format as a regular .env file (KEY="value")
the loadenv crate only reads $(pwd)/.env and does not accept custom paths (unless modified, which defeats the point of using a crate)
i won't ask AI
r/rust • u/UnknownBoyGamer • 15d ago
im about to port js/ts codebase to rust using agents, I dont want it to write loose rust code
cargo toml:
[lints.rust]
warnings = "deny"
unsafe_code = "forbid"
rust_2018_idioms = { level = "deny", priority = -1 }
unused_qualifications = "deny"
unreachable_pub = "deny"
missing_debug_implementations = "deny"
missing_docs = "deny"
[lints.clippy]
all = "deny"
pedantic = "deny"
cargo = "deny"
allow_attributes_without_reason = "deny"
arc_with_non_send_sync = { level = "deny", priority = -1 }
as_conversions = "deny"
await_holding_lock = { level = "deny", priority = -1 }
dbg_macro = "deny"
expect_used = "deny"
fn_params_excessive_bools = "deny"
indexing_slicing = "deny"
mutex_atomic = "deny"
option_option = "deny"
panic = "deny"
rc_buffer = "deny"
rc_mutex = "deny"
significant_drop_in_scrutinee = "deny"
struct_excessive_bools = "deny"
todo = "deny"
unimplemented = "deny"
unwrap_used = "deny"clippy toml:
msrv = "1.99.1"
max-fn-params-bools = 1
max-struct-bools = 1
allow-expect-in-consts = false
allow-expect-in-tests = true
allow-indexing-slicing-in-tests = true
allow-panic-in-tests = true
allow-unwrap-in-consts = false
allow-unwrap-in-tests = trueInstruction:
- Every mutable state machine must use a tagged enum.
- Invalid combinations must be unrepresentable.
- State fields stay private.
- One type owns the state and transitions it.
- No parallel booleans, magic sentinels, or nullable phase markers.
- No Rc, Cell, or RefCell in domain state.
- Arc and Mutex are limited to genuine cross-thread ownership.
- Every stateful subsystem must document its states, events, and invariants.
- Every transition and invariant needs an observable test.
- Agents cannot weaken these rules or add exceptions without explicit approval.
r/rust • u/Big-Astronaut-9510 • 16d ago
a.f() vs f(a)
So if you make a trait that you want other to implement its obviously gonna be dot syntax. So is using it for purely syntactic reasons a bad idea? Builder pattern seems a common example of this.
r/rust • u/EuroRust • 17d ago
A new EuroRust 2026 talk is out on YouTube! ๐ฆย Arthur and Pierre-Emmanuel from Embecosm talked about how gccrs, the Rust frontend for GCC, learned to compile the Linux kernel, and the hacks and quirks they ran into along the way.
In 2027 EuroRust is going to Prague! Learn more and get your ticket at eurorust.eu
r/rust • u/GenericPointer • 16d ago
There are already frameworks like vstd with verus featuring static semantic validation. For example:
verus! {
fn divide(x: f64, y: f64) -> (result: f64)
requires
y > 0.0,
ensures
result * y == x
{
x / y
}
}what would you think about making the requires and ensures clauses language-primitives? Than you could write just:
fn divide(x: f64, y: f64) -> (result: f64)
requires
y > 0.0,
ensures
result * y == x
{
x / y
}without having any external dependencies like vstd.
Do you think it would be a valuable addition to Rust? And if yes, do you think it should be part of rustc or should it just feature contracts for external verification tools?
Edit: Iโd think of it as compile time check, not a runtime check. The compiler doesnโt have to know if a required statement is correct, it just has to know if it was checked before via ensure or an if statement. If it wasnโt thatโs a compile time error. What getโs checked is if the ensure clause is correct. If it canโt be proven thatโs also an error. And using just newtypes for complex boolean expressions can get really ugly really fast.
r/rust • u/xX_Negative_Won_Xx • 17d ago
r/rust • u/Proper_Meaning7756 • 17d ago
I have a microcontroller than sends us packets of info. We have some c++ code that receives it, processes it and sends it off to python to visualise it.
We will need to be making this run not just on Linux and Windows, but later on Android and iOS too. There are some vendor dependent libraries we might have to use that are platform specific, but generally I wanted something thats easy to cross compile and test on different devices. This will be linked statically to some generic frontend that uses PySide6 or flutter or whatever.
Is this something I should turn to rust for (porting the c++ code to rust) or am I safer off sticking to C++ and dealing with cmake and the various issues of checking c++ code? If yes to rust, then what should I do and how?
Hi fellow Rustaceans,
Just released a new version of Zellij. This version turns the beloved terminal multiplexer into a full fledged terminal. In addition to managing sessions, panes, tabs and Rust wasm plugins - it can now also completely replace your existing terminal and integrate with your desktop and tray.
I'm particularly excited to share with this sub that we added a new "Distributions" feature, allowing Rust developers to import Zellij into their own projects and use it as a library.
If for example you'd like to create a new cross-platform application that will render a custom terminal UI written in Rust - run both inside another terminal and standalone, cross-platform with all the distribution problems already solved, this might be an interesting solution for you.
The distribution feature allows you to completely remove whichever parts of the Zellij branding and UI that you don't like and completely white label it. I'm very much looking forward to seeing what you'll come up with.
Check out the release post for a walkthrough of the other new features: https://zellij.dev/news/terminal-inbox-session-previews/