Skip to content

Instantly share code, notes, and snippets.

@lkuper
Created July 6, 2012 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lkuper/3062810 to your computer and use it in GitHub Desktop.
Save lkuper/3062810 to your computer and use it in GitHub Desktop.
// Instance coherence enforcement should forbid this situation
mod C1 {
trait C1Trait { }
}
mod C2 {
type C2Type = int;
}
mod C3 {
import C1;
import C2;
// conflicts with potential other impls
impl of C1Trait for C2Type { }
}
// But this should be OK:
mod C3v2 {
import C1;
import C2;
enum local_myType = myType;
impl of C1Trait for local_myType { }
}
// As should this:
mod C1v2 {
import C2;
trait C1Trait { }
impl of C1Trait for C2Type { }
}
mod C3v2 {
import C1v2; // imports the trait as well as its impl
}
mod C4 {
import C1v2; // imports the trait as well as its impl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment