News for hackers. Stuff that matters.
Re:Rust project goals: Immobile types and guaranteed destruc... by klauserc on Monday August 03, 2026 @09:07AM (#49155308)
An alternative way to "forget" a value is to hand it off to another thread that then loops infinitely.

Could of course be plugged by saying `!Forget : !Send`, but wouldn't that preclude legitimate useful scenarios for `!Forget`?

Re:Rust project goals: Immobile types and guaranteed destruc... by Dagonfly on Monday August 03, 2026 @10:11AM (#49156044)
Passing ownership to another thread is not the same as forgetting/leaking.

The point of !Forget is ensuring that once the owner goes out of scope the destructor must be guaranteed to run. An infinite loop is not a problem, cause the new thread will never leave its scope. Ref-cycles are a problem, cause you can create a ref-cycle. Then the program flow leaves the scope which will run the drop on all RC's but not the drop on the inner type.

Re:Rust project goals: Immobile types and guaranteed destruc... by aw1621107 on Monday August 03, 2026 @09:15AM (#49155381)
> An alternative way to "forget" a value is to hand it off to another thread that then loops infinitely.

Might be able to address that by only allowing such a handoff to a thread spawned via some scoped abstraction to ensure that progress can only be made if/when the spawned thread terminates?

Re:Rust project goals: Immobile types and guaranteed destruc... by afdbcreid on Monday August 03, 2026 @03:45PM (#49160503)
The more accurate definition of `!Forget`, similar to `Pin<&mut !Unpin>`, is not "can be leaked" but "if the underlying storage is reused, the destructor is guaranteed to run". This enables all important (decidable - preventing leaking is undecidable, even in GC languages) use-cases, and sending the value to a thread does not break this contract.