Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{-# LANGUAGE FlexibleContexts, GADTs, TypeFamilies #-}
class T a where
type Config a
getConfig :: a -> Config a
data D where
T :: T a => a -> D
trait T {
type Config;
fn getConfig(&self) -> Self::Config;
}
enum D {
T(Box<dyn T>)
}
/*
error[E0191]: the value of the associated type `Config` (from trait `T`) must be specified
--> test_associated_types.rs:7:15
|
2 | type Config;
| ------------ `Config` defined here
...
7 | T(Box<dyn T>)
| ^ help: specify the associated type: `T<Config = Type>`
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment