codegen icon indicating copy to clipboard operation
codegen copied to clipboard

Const + Static

Open Lucretiel opened this issue 6 years ago • 1 comments

It would be nice if we could add const or static global items to codegen scopes. To ensure correctness, these could only be allowed for a small set of primitives, like ints and floats and &str, as well as arrays / slices / references of those. I have a password generator which uses build.rs to compile a list of words directly into the source; codegen would be a great addition to this functionality.

Lucretiel avatar Mar 27 '19 01:03 Lucretiel

Should not be limited to simple types. See https://doc.rust-lang.org/std/sync/struct.LazyLock.html for an example of a complex type being used in static.

brandonryan avatar Oct 31 '23 02:10 brandonryan