Closed
Description
I tried this code: play
#![feature(const_trait_impl)]
#[const_trait]
trait Foo {
type Assoc: ~const Foo;
fn foo() {}
}
const fn foo<T: ~const Foo>() {
<T as Foo>::Assoc::foo();
}
I expected to see this happen: Compiles
Instead, this happened: errors
error[E0277]: the trait bound `<T as Foo>::Assoc: ~const Foo` is not satisfied
--> src/lib.rs:10:5
|
10 | <T as Foo>::Assoc::foo();
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `~const Foo` is not implemented for `<T as Foo>::Assoc`
|
note: the trait `Foo` is implemented for `<T as Foo>::Assoc`, but that implementation is not `const`
--> src/lib.rs:10:5
|
10 | <T as Foo>::Assoc::foo();
| ^^^^^^^^^^^^^^^^^^^^^^
help: consider further restricting the associated type
|
9 | const fn foo<T: ~const Foo>() where <T as Foo>::Assoc: ~const Foo {
| +++++++++++++++++++++++++++++++++++
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error