Lint transmute where source type is unspecified. #715
Labels
A-lint
Area: New lints
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
L-correctness
Lint: Belongs in the correctness lint group
T-middle
Type: Probably requires verifiying types
This is an easy way to create UB. For example:
The error (resulting in segfault) might be a little hard to spot. The problem is that the array is transmuted into a null pointer. The transmute argument should be
&bytes
instead.By forcing the programmer to add type annotations, he or she is not as likely to commit this mistake (since it will be catched during type checking):
Since this is a major source of bugs resulting in UB, I propose adding a lint being
deny
by default, which forces the programmer to annotate the type.The text was updated successfully, but these errors were encountered: