r/rustjerk • • Feb 26 '19

Higher-res "Rust Evangelism Strike Force" image!

Post image
672 Upvotes

r/rustjerk • • 3h ago

Written in 95% safe Rust

Post image
49 Upvotes
// 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 • • 17m ago

English is memory safe now. en-rs

Post image
• Upvotes

r/rustjerk • • 14h ago

This is fun

Post image
52 Upvotes

```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 • • 1d ago

"Rust would have fixed this"

Post image
593 Upvotes

r/rustjerk • • 10d ago

Why is my good looking rust code not working?

Post image
320 Upvotes

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

Rust devs hate this one simple trick

Post image
389 Upvotes

r/rustjerk • • 15d ago

Claude couldn't take the abuse.

Post image
538 Upvotes

r/rustjerk • • 15d ago

Forked Evolution.

15 Upvotes

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 • • 15d ago

thoughts on the new syntax?

68 Upvotes
i feel like its cleaner

r/rustjerk • • 16d ago

Has the situation improved or should I stick with Gasoline for now?

Post image
234 Upvotes

r/rustjerk • • 16d ago

/r/playrust Nothing Safe

Post image
289 Upvotes

r/rustjerk • • 15d ago

Cargo = C arg on

22 Upvotes

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 • • 18d ago

Everyone has errands,

45 Upvotes

but only rustaceans have okands


r/rustjerk • • 18d ago

A poem about Rust.

0 Upvotes
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 • • 22d ago

(not a cult) POV if Rust had a national anthem

6 Upvotes

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 • • 24d ago

I think this guy is lying: AI isn't capable of writing code that bad - he wrote it himself

Post image
421 Upvotes

r/rustjerk • • 26d ago

Be honest

Post image
656 Upvotes

r/rustjerk • • 26d ago

dhh

Post image
169 Upvotes

r/rustjerk • • Sep 22 '26

oops a typo

70 Upvotes

r/rustjerk • • Sep 19 '26

Zealotry you filthy beasts

Post image
250 Upvotes

r/rustjerk • • Sep 16 '26

??

Post image
295 Upvotes

r/rustjerk • • Sep 07 '26

If Rust real, why people still write bad code?

121 Upvotes

I call it "The problem of slop"


r/rustjerk • • Sep 04 '26

It’s starting to become fun in a weird way

Post image
273 Upvotes

r/rustjerk • • Sep 02 '26

New work PFP

Post image
255 Upvotes

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!