Description
Right now we don't allow unsizing casts (array -> slice or type -> dyn Trait) in const fns on stable.
While we can't allow unsizing to dyn Trait
until we've figured out trait bounds in const fns, we can easily allow unsizing casts for slices, there's no reason not to have them. The only reason we didn't have them in the initial min_const_fn feature gate was the fact that we preferred overly aggressive rules over accidental stabilization.
The relevant code is
rust/src/librustc_mir/transform/qualify_min_const_fn.rs
Lines 162 to 165 in dc45735
We need to check the destination and source types for slice and array respectively and permit the cast in that case. We also need to recurse with check_operand
on the value that is being casted.