Elektrine lite

← Feed

@charokol@lemmy.world

Post #3638104

2026-07-06 22:10 UTC

I know nothing about rust but I assume borrow checker is some integral part of it that this guy somehow has never heard of?

Replies (4)

  • @calcopiritus@lemmy.world 2026-07-06 22:40

    Yes. Someone that knows just a little more of rust than you do would know what the borrow checker is. It’s the core feature of rust. Like talking about java and not knowing what “inheritance” is.

    Open ##3638612

  • @HuntressHimbo@lemmy.zip 2026-07-06 23:01

    Some would call it the single biggest source of gotcha moments learning the language

    Open ##3638855

  • Very integral. When someone says they're "struggling with Rust", Rust's whole shtick is the way it manages memory, which is the rules enforced by the borrow checker. Basically: When you want to store values in variables in any programming language, the memory should be allocated when you need it and freed as soon as you don't anymore. Traditionally there are two ways this is done: You manage it completely yourself, which is "unsafe" as you can forget to free memory you no longer need. This is called leaking memory. Or "reference" the location of something you freed previously, thereby attempting to read data you may not have permission to read (the OS will usually prevent that and kill the program), or reading and using a value you didn't expect, causing undefined behavior and fun to deal with bugs. The language, sometimes using a process which runs alongside your main program, manages memory. Which adds lots of overhead. Rust has it's own way of doing this: It adds some rules on how you can pass around references and ownership and these rules are affected by whether you can or can't edit the referenced data. All just so the compiler knows the lifetime of the vars that hold that data and when it can free it (before the program is even compiled, so no overhead when the program is running). Not following the strict rules prevents your program from being compiled into an executable. The compiler gives very helpful info, tips, and pointers™ though, Rust is also know for this.

    Open ##3638870

  • @JackbyDev@programming.dev 2026-07-07 20:41

    Yeah, I think the flow was this, Is this vibe coded? Partially, because of some of the features of Rust. Borrow checker? (Humourous misunderstanding ensues.) Basically asking if the thing that gave them trouble was the borrow checker.

    Open ##3657412