Last active
June 21, 2017 23:11
-
-
Save greyblake/1c55be8537aea058ecbc1028ab88a5c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait A { | |
fn a(&self); | |
} | |
trait B { | |
fn b(&self); | |
} | |
trait C { | |
fn c(&self); | |
} | |
// Implement C for types, which implement A. | |
impl<T: A> C for T { | |
fn c(&self) { | |
self.a() | |
} | |
} | |
// NOTE: Fails to compile. | |
// Intention: implement trait C for the types, which implement B, but do not implement A. | |
impl<T: B + !A> C for T { | |
fn c(&self) { | |
self.b() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment