Apparently, this crate generates code like
Some(include_dir::Dir::new(
"",
&[include_dir::DirEntry::File(include_dir::File::new(
"test_file.txt",
b"",
))],
))
It then relies on the part in &[...] to be const-promoted. However, const-promotion of arbitrary function calls is problematic, and in Rust 1.79 it has been limited to only occur in straight-line code, causing compilation failures for some users of this crate.
The intended way to obtain 'static references to things computed by const fn is to make this explicitly const -- either via const { ... } blocks, or (when support for older versions of Rust is required), via explicit const items:
Some(include_dir::Dir::new(
"",
{
const ENTRIES: &'static [DirEntry<'static>] = &[include_dir::DirEntry::File(include_dir::File::new(
"test_file.txt",
b"",
))];
ENTRIES
},
))
Would be good to get this crate updated to avoid problems related to promotion of function calls. :)
Apparently, this crate generates code like
It then relies on the part in
&[...]to be const-promoted. However, const-promotion of arbitrary function calls is problematic, and in Rust 1.79 it has been limited to only occur in straight-line code, causing compilation failures for some users of this crate.The intended way to obtain
'staticreferences to things computed byconst fnis to make this explicitlyconst-- either viaconst { ... }blocks, or (when support for older versions of Rust is required), via explicitconstitems:Would be good to get this crate updated to avoid problems related to promotion of function calls. :)