-
-
Save comex/ee809f4bdeec5c6cf7b1751ee1642193 to your computer and use it in GitHub Desktop.
This file contains 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
mod private { | |
pub trait Super { | |
fn foo(self); | |
} | |
pub trait Child: Super {} | |
impl Super for u32 { | |
fn foo(self) {} | |
} | |
impl Child for u32 {} | |
} | |
use private::Child; | |
fn huh<T: Child>(x: T) { | |
x.foo(); // OK | |
} | |
fn hah(x: u32) { | |
huh(x); // OK | |
x.foo(); // error: no method named `foo` found | |
// for type `u32` in the current scope | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment