S0032: bitwise not requires Int
Generated from rellum-diagnostics/src/db.rs.
Explanation
The bitwise ~ operator flips bits in an integer value. It is not logical negation and is not defined for Float, Bool, Char, String, arrays, records, or enums.
Common causes
- using ~ on a Bool when logical not was intended
- using ~ on a Float or String
- expecting implicit conversion to Int
Canonical fixes
- apply bitwise ~ to an Int
Before:
mask = ~flag
After:
mask = ~bits
- use logical not syntax for Bool values
Code example
mask = ~flag