coop-rs/rust

failed to evaluate generic const expression

Opened this issue · 1 comments

rust-lang#107274 -> https://github.com/rust-lang/rust/actions/runs/3999992931/jobs/6864578721#step:26:778:

...
Compiling std_detect v0.1.5 (/checkout/library/stdarch/crates/std_detect)
error: failed to evaluate generic const expression
    --> /checkout/library/alloc/src/vec/mod.rs:2921:10
     |
2921 |     [(); core::alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRED)]:,
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: the crate this constant originates from uses `#![feature(generic_const_exprs)]`
help: consider enabling this feature
    -->  |/cargo/registry/src/github.com-1ecc6299db9ec823/miniz_oxide-0.5.3/src/lib.rs:1:1
     |
1    | #![feature(generic_const_exprs)]
     |

I read this as "the consumer crate doesn't specify generic_const_exprs, but it should". Is this the right meaning?

If so, please shed more light. Because, consumer crates don't need to specify generic_const_exprs:

Please explain or share any tips.

Mmm. I strongly recommend you try to build CoVec types separately from inside the Rust compiler and standard library, ones which support the custom allocation patterns you are thinking of, before you try to add that functionality back into Vec itself. It's not clear to me why your proposal only would support the global allocator, instead of possibly any custom allocator with the appropriate support. However if you did have to extend the global allocator Rust defines, tampering with that trait and its implementations would be much easier than trying to directly modify all the types in alloc.