News for hackers. Stuff that matters.
Re:The memory models that underlie programming languages (2016) by moonchild on Thursday June 10, 2021 @05:49PM (#27466260)
Yes, of course you can express this in rust. The topic at hand is whether it can be expressed in terms of rust's ownership policies. Your example shows that it cannot; it returns an object of static lifetime, avoiding the issue completely.
Re:The memory models that underlie programming languages (2016) by littlestymaar on Friday June 11, 2021 @03:22AM (#27470282)
The topic at hand was about the comparison between C and Rust in terms of memory model. Ownership policies are one restriction safe Rust uses to ensure that the user is adhering to its memory model, but Rust is not limited to safe Rust and you can op-out ownership policies if you use raw pointers.

The difference between Rust and C in terms of memory model isn't ownership, it's “mutable xor shared”.

Re:The memory models that underlie programming languages (2016) by drran on Friday June 11, 2021 @05:39AM (#27471107)
I cannot understand your question about "ownership policies". Rust have only one ownership policy: one owner per object.

It's possible to use pointers to circumvent the restriction and then control when object is destructed using ManuallyDrop[0], so burden of memory bookkeeping will be shifted from Rust compiler to the programmer.

[0]: https://doc.rust-lang.org/core/mem/struct.ManuallyDrop.html