Closed RalfJung closed 3 months ago
This was odd. I tried running the crate's tests with 1.79 and nightly
, and it built just fine 🤔
I've made the fix anyway. Let's see if it resolves things for other people.
Thanks for the quick fix!
This was odd. I tried running the crate's tests with 1.79 and nightly, and it built just fine 🤔
Yeah, https://github.com/rust-lang/rust/pull/121557 is rather odd, making it tricky to write a good test. This still works fine:
pub static ASSETS_DIR: Option<include_dir::Dir<'_>> = Some(include_dir::include_dir!("$CARGO_MANIFEST_DIR/assets"));
but putting the include_dir!
inside an if
breaks it. It's kind of a hack but for backcompat reasons it's hard to do better...
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
'static
references to things computed byconst fn
is to make this explicitlyconst
-- either viaconst { ... }
blocks, or (when support for older versions of Rust is required), via explicitconst
items:Would be good to get this crate updated to avoid problems related to promotion of function calls. :)