-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.
Description
Because an enum takes the size of its largest member, it is very easy to have enums whose size grows surprisingly large if you are not careful. ast::Expr
, for example, is currently 120 bytes in our compiler. It'd be helpful to have a lint that checks the size of the smallest and largest variant in an enum and reports if the difference is "too" big. What "too big" means I don't know -- perhaps if one is 2x the other?
One issue is what to do about generic enums. We could (for now) just assume that generics have a certain size, or else wait and report lint warnings on individual instantiations -- but this seems like a warning that should be associated with the def'n of the structure.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.