4 ms·
My point was that both are static, but you’re right that one being done at the type checking stage probably makes a big difference in the feasibility. > the po
by arijun 3y ago
My point was that both are static, but you’re right that one being done at the type checking stage probably makes a big difference in the feasibility.
> the potential to produce surprising results
That’s actually the big reason for that capability. If you do
let result: Result<_,!> = …
let ok(fine) = result
, if result ever changes from infallible to fallible, you get a compile error rather than the runtime error you would get with unwrap. In fact, when looking it up, it turns out that specific case was a big part of the motivation for the “!” type in the first place! I think the above code probably compiles in nightly because of that.