Main public logs
Appearance
Combined display of all available logs of JOHNWICK. You can narrow down the view by selecting a log type, the username (case-sensitive), or the affected page (also case-sensitive).
- 08:09, 16 November 2025 PC talk contribs created page Rust’s Borrow Error : Why You Can’t Store a Value and a Reference to It in the Same Struct (Created page with "You write what feels like perfectly reasonable Rust: struct Thing { count: u32, } struct Combined<'a>(Thing, &'a u32); fn make_combined<'a>() -> Combined<'a> { let thing = Thing { count: 42 }; Combined(thing, &thing.count) } …and the compiler very kindly replies: error: cannot return value referencing local variable 'thing' error: 'thing' does not live long enough You stare at it. But the struct owns the Thing. The reference is to a field inside that...")