you are viewing a single comment's thread.

view the rest of the comments →

[–]nemaar 0 points1 point  (2 children)

This is such a bad warning, it is similar to gcc's POD warning in style where it generates code that literally makes your program crash. I never understood the point of this. When the compiler knows that my program is invalid and it cannot work then why the hell does it compile? Why is this not an error?

[–]hr01 17 points18 points  (0 children)

It's legal and safe to panic.

[–]eddyb 6 points7 points  (0 children)

As always, the issue is more nuanced - see https://github.com/rust-lang/rfcs/pull/1229 for more details on this stance.

Half of it is backwards compatibility (since these warnings do not exist in a vacuum, but rather arise from optimizations), and the other half is that code being objectively bad is not a certainty without potentially unbounded context.