On 29/03/14 12:10 AM, comex wrote: > On Fri, Mar 28, 2014 at 8:14 AM, Daniel Micay <danielmi...@gmail.com> wrote: >> Lifetimes serve no purpose other than to prevent the programmer from >> doing stuff, and are *entirely* stripped out before code generation. Do >> you want to override/disable borrow checking and freezing too? >> >> There's also the exhaustiveness check in match and let expressions. >> There's the imperfect flow control analysis used to guarantee that >> there's a return before the end of a function. There's a dynamic check >> on integer division for a zero divisor, and INT_MIN / -1 needs to be >> checked for too with signed integer division. There's the dynamic borrow >> checking performed on RefCell, which has to be used if you want >> mutability combined with shared ownership of a non-plain old data type >> in Rc<T>. > > This is unfair. You're mixing up static checks such as > exhaustiveness, freezing, and lifetimes, which have no performance > impact (or at least, the performance impact caused by their > limitations would be mitigated only by fundamentally rearchitecting > the user code, not flipping a check off), with dynamic checks such as > array bounds, RefCell, and division, which have an impact and can be > flipped off.
These do often have a performance impact despite being static checks. The borrow checker forbids many valid patterns, and forces either a less efficient solution or using `unsafe`. This is no different from how you are forced to choose between safe indexingand unsafe indexing. There seems to be a serious misunderstanding about bounds checking in Rust in this thread. The bounds check is *not* a dynamic check inserted to make sure that the code is valid. It is a normal runtime check, like checking if a string is valid when parsing it into an integer. There is a semantic difference between that and assuming the string is valid.
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev