Closed
Description
The following code errors, and the error contains a suggestion how to fix the error:
#![feature(generic_associated_types)]
#![feature(const_generics)]
#![feature(const_evaluatable_checked)]
trait Funk<const P: usize> {
type Item<const N: usize>: Funk<{core::mem::size_of::<Self>()}>;
}
The error message states:
error[E0277]: the size for values of type `Self` cannot be known at compilation time
--> src/lib.rs:6:59
|
6 | type Item<const N: usize>: Funk<{core::mem::size_of::<Self>()}>;
| ^^^^ doesn't have a size known at compile-time
|
help: consider further restricting `Self`
|
5 | trait Funk: Sized<const P: usize> {
| ^^^^^^^
error: aborting due to previous error; 3 warnings emitted
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground`
Obviously, writing trait Funk: Sized<const P: usize> {
is invalid syntax.