Open
Description
I tried this code:
trait Trait {}
trait Super {
type Assoc;
}
trait Sub: Super where <Self as Super>::Assoc: Trait {}
fn user<T:Sub>(t:T) {}
I expected to see this happen:
It compile
Instead, this happened:
Compiling playground v0.0.1 (/playground)
error[[E0277]](https://doc.rust-lang.org/stable/error_codes/E0277.html): the trait bound `<T as Super>::Assoc: Trait` is not satisfied
--> src/lib.rs:8:11
|
8 | fn user<T:Sub>(t:T) {}
| ^^^ the trait `Trait` is not implemented for `<T as Super>::Assoc`
|
note: required by a bound in `Sub`
--> src/lib.rs:6:48
|
6 | trait Sub: Super where <Self as Super>::Assoc: Trait {}
| ^^^^^ required by this bound in `Sub`
help: consider further restricting the associated type
|
8 | fn user<T:Sub>(t:T) where <T as Super>::Assoc: Trait {}
| ++++++++++++++++++++++++++++++++
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error
Meta
Playground (rust 1.69.0 on May 24 2023), and
rustc --version --verbose
:
rustc 1.69.0 (84c898d65 2023-04-16) (built from a source tarball)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-apple-darwin
release: 1.69.0
LLVM version: 15.0.7