Closed
Description
#![feature(min_const_fn)]
use std::marker::PhantomData;
pub struct Foo<T>(PhantomData<T>);
pub trait Bar {}
impl<T: Bar> Foo<T> {
pub const fn foo() -> Self {
Foo(PhantomData)
}
}
fn main() {}
Errors:
Compiling playground v0.0.1 (/playground)
error: trait bounds other than `Sized` on const fn parameters are unstable
--> src/main.rs:5:6
|
5 | impl<T: Bar> Foo<T> {
| ^
error: aborting due to previous error
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
The error should mention which feature has to be enabled to make use of this. The feature is const_fn
.