And I really do not like the idea that some third-party library that happened to use decides that I can't turn off a expensive check that would never be triggered in the real world.
Now if the contract was instead, it must be proved at compile time I'd be for that. I don't know if theorem checkers are good enough to pull that off.
I don't have a problem with this, library writers are free to design any way they want. If this requires expensive checks, that's a library design choice, and users are free to choose a different library if that's not what they want.
You're aware that third-party library developers have always been able to put all sorts of expensive runtime checks in their code which can't be turned off, right?
How can you know it will never be triggered in the real world? Isn’t that the entire point of this? To catch those bugs and prevent things from going off the rails and continuing on?
If you know it will never happen, what’s the point of the feature?