Associated constants cannot be used to initialize storage fields #6543
Labels
bug
Something isn't working
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
compiler
General compiler. Should eventually become more specific as the issue is triaged
Associated constants cannot be used to initialize storage fields. E.g., the following code results in a compilation error:
If the associated constant was used before to initialize some other module constant, e.g.,
const CONST: u8 = S::S_ASSOC;
the initialization will be possible.This is very likely because we have a dedicated step that compiles module constants solely for the purpose of using them in the
storage
initialization. Associated constants are not part of that compilation step.When fixing this issue, adjust the
associated_const_in_decls_of_other_constants
test which is linked to this issue via GitHub link in the test TODO.The text was updated successfully, but these errors were encountered: