Open
Description
I tried this code:
const fn newv() -> Vec<Box<dyn std::any::Any>> {
Vec::new()
}
I expected this to compile, since Vec::new()
is a const function, and no dyn
anything needs to be created.
Instead, this happened:
Compiling playground v0.0.1 (/playground)
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> src/lib.rs:1:20
|
1 | const fn newv() -> Vec<Box<dyn std::any::Any>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn)]` to the crate attributes to enable
Meta
rustc --version --verbose
:
1.51.0 on the playground