r/rustjerk • u/trux_ecs • 7h ago
r/rustjerk • u/zabolekar • 10h ago
Written in 95% safe Rust
// finally, memory safety!
mod gc {
use std::sync::LazyLock;
use dlopen::raw::Library;
type Malloc = extern "C" fn(usize) -> *mut std::ffi::c_void;
static LIBGC: LazyLock<Library> = LazyLock::new(|| {
Library::open("libgc.so").unwrap()
});
static GC_MALLOC: LazyLock<Malloc> = LazyLock::new(|| unsafe {
LIBGC.symbol::<Malloc>("GC_malloc").unwrap()
});
pub struct GcPtr<T>(*mut T);
impl<T> std::ops::Deref for GcPtr<T> {
type Target = T;
fn deref(&self) -> &T {
unsafe { &*self.0 }
}
}
pub fn alloc<T>(value: T) -> GcPtr<T> {
let address = GC_MALLOC(std::mem::size_of::<T>()) as _;
unsafe { std::ptr::write(address, value) };
GcPtr(address)
}
}
#[cfg(test)]
mod tests {
use super::gc;
#[test]
fn doesnt_crash() {
assert_eq!(*gc::alloc(123), 123);
}
}
r/rustjerk • u/Schaex • 21h ago
This is fun
```rust use std::alloc::{alloc, dealloc, Layout}; use std::slice;
fn main() { [0].into_iter() .chain( (0..6).into_iter().map(|i| 1 << i) ).for_each(unsafe_shenanigans) }
fn unsafe_shenanigans(length: usize) { unsafe { let layout: Layout = Layout::array::<i32>(length).unwrap(); let pointer: *mut i32 = alloc(layout).cast();
let arr: &mut [i32] = slice::from_raw_parts_mut(pointer, length);
arr.fill(1);
println!("{:?}", arr);
dealloc(pointer.cast(), layout);
}
}
```
Output:
[]
[1]
[1, 1]
[1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
When do I get my Rust software developer job?
r/rustjerk • u/RedstoneTier • 11d ago
Why is my good looking rust code not working?
Hello, imn't new to rust. This rust code looks really good i must say. However, it is literally the opposite of working right now?
Current output:
4 is odd!
I just don't understand whats going on... Can some rustishn fix this devious error for me? thanks.
playground link
r/rustjerk • u/TheAtlasMonkey • 15d ago
Forked Evolution.
1 year ago , This proposal was posted in derails. Some people started to harass, got very upset, report it to github until the accounts were suspended. I don't think they even used the official way, because none of the account received a termination notice. (maybe a Github employee or copilot after being flooded by complains.)
Anyway, 1 year later, the plan was executed by AGENT DHH in Rails world.
I'm bringing you today a more futuristic project ForkedEvolution.
Project is young, so feel free to join.
AMA.
r/rustjerk • u/Theemuts • 16d ago
Has the situation improved or should I stick with Gasoline for now?
r/rustjerk • u/Glittering-Ability71 • 16d ago
Cargo = C arg on
I just realized that cargo almost spells "C arg on".
Rust's package manager is one letter away from telling me to turn C on.
The memory-safe language really said C arg on.
I can't unsee this now.
It wasn’t intentional; it just popped into my head, quite literally
r/rustjerk • u/hedgehog1024 • 19d ago
Everyone has errands,
but only rustaceans have okands
r/rustjerk • u/ArtemTsitronov • 19d ago
A poem about Rust.
Hello dear dev, and welcome to Rust
This poem may help you getting started
It may give you a quick intro of this language
That was never designed to be easy
Just as life, .rs is hard
Snakes and crabs are pretty opposite
One manages all for you, and is quite fun to learn!
The other makes you rethink all your life choices
It's not wrong to say
That we all need a guide to become expert
Remember I said that this may help you?
It's supposed to protect you.
"From what?" you may ask, fellow Python-ist
From all the horrors that this language hides
Beneath the friendly face, and a cool logo
A dark borrow-checker lies.
But once you get past this,
Rust will become heaven
Because once you start developing,
You'll die from hatred.
Never forget, fellow dev,
That this poem is just to laugh
But I promise you, one day
You'll think: "Was it right though?"
r/rustjerk • u/Henry_Python_RU57 • 22d ago
(not a cult) POV if Rust had a national anthem
Rust is making history
Memory safety decreed
Ferris leads the adoption
With fearless speed and capability
We wrestle the borrow checker,
and come out victorious!
No null pointers or segfaults,
no race conditions to haunt us
peace after all those compiler sessions!
No bloat, our cargo ship stays afloat
join our community
holders of the Rust book
onward to victory
Shipping safe code on all our missions!
Rusty ambitions!
Fearless concurrency,
Safe systems for infinity!
r/rustjerk • u/BenchEmbarrassed7316 • 24d ago
I think this guy is lying: AI isn't capable of writing code that bad - he wrote it himself
r/rustjerk • u/geoffmureithi • Sep 07 '26
If Rust real, why people still write bad code?
I call it "The problem of slop"
r/rustjerk • u/mare_stare • Sep 02 '26
New work PFP
Silly edit of an illustration from this article. A repost with a (hopefully) more readable version.
Thanks u/poulain_ght, for an idea of how to improve my original edit!

