| ▲ | kibwen 3 hours ago | |||||||||||||
The `unsafe` keyword means something specific in Rust, and panicking isn't unsafe by Rust's definition. Sometimes avoiding partial functions just isn't feasible, and an unwrap (or whatever you want to call the method) is a way of providing a (runtime-checked) proof to the compiler that the function is actually total. | ||||||||||||||
| ▲ | echelon 2 hours ago | parent [-] | |||||||||||||
Panics should be explicit, not implicit. 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. | ||||||||||||||
| ||||||||||||||