Re:Cloudflare outage on November 18, 2025 post mortem
by bigstrat2003 on Tuesday November 18, 2025 @11:04PM
(#45975732)
unwrap is explicit.
Re:Cloudflare outage on November 18, 2025 post mortem
by speedgoose on Wednesday November 19, 2025 @02:35AM
(#45976831)
Not explicit enough, apparently.
Re:Cloudflare outage on November 18, 2025 post mortem
by echelon on Wednesday November 19, 2025 @06:55AM
(#45978489)
What happens if a dependency of mine unwrap()s or expect()s something that is an error or isn't there? What should I do?
How was I informed as a user? It's not in the type signature.
Sounds like I get to indeterminately crash at runtime and have a fun time debugging.
Re:Cloudflare outage on November 18, 2025 post mortem
by the8472 on Wednesday November 19, 2025 @10:02AM
(#45980418)
That would require an effects system[0] like Koka's[1]. Then one could not only express the absence of panics but also allocations, infinite loops and various other undesirable effects within some call-trees.
This is a desirable feature, but an enormous undertaking.
Absent that there are hacks like no_panic[2]
[0] https://blog.yoshuawuyts.com/extending-rusts-effect-system/ [1] https://koka-lang.github.io/koka/doc/book.html#why-effects [2] https://crates.io/crates/no-panic
Re:Cloudflare outage on November 18, 2025 post mortem
by wrs on Wednesday November 19, 2025 @12:12PM
(#45982049)
Same thing that would happen if it did a match statement and panicked. The problem is the panic, not the unwrap.
I don’t think you can ever completely eliminate panics, because there are always going to be some assumptions in code that will be surprisingly violated, because bugs exist. What if the heap allocator discovers the heap is corrupted? What if you reference memory that’s paged out and the disk is offline? (That one’s probably not turned into a panic, but it’s the same principle.)
unwrap() should effectively work as a Result<> where the user must manually invoke a panic in the failure branch. Make special syntax if a match and panic is too much boilerplate.
This is like an implicit null pointer exception that cannot be statically guarded against.
I want a way to statically block any crates doing this from my dependency chain.