One weird misconception I’ve seen popping up is that Rust’s borrow check is only relevant to heap-allocated data.
-
-
Simple example of how the borrow check is important: let mut x: Result<i32,f32> = Ok(1); let y: &i32 = http://x.as _ref().unwrap(); x = Err(1.0); println!(“{}”, y); // unsafe cast of int to float in safe code
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
There's always going to be somebody on the internet saying something silly like this. Not worth picking a fight each time. A more productive conversation w.r.t. embedded stack usage: Stack overflow prevention/checking is still missing for most platforms, and we really need help.
-
This Tweet is unavailable.
- 4 more replies
New conversation -
-
-
that's so weird, since at least personally i run into lifetime issues with locals (so, stack-allocated) i use in weird ways regularly..
-
i feel like your first immutable borrow of a borrowed mutable value would be a clear counterexample to the argument, but maybe they're thinking about borrows and mutability independently
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.