Last active
December 11, 2015 14:49
-
-
Save alexcrichton/4617145 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
trait Foo { | |
static fn foo(int) -> @self; | |
} | |
struct A { a: int } | |
impl A: Foo { | |
static fn foo(a: int) -> @A { @A{a: a} } | |
} | |
struct B { b: int } | |
impl<T: Foo> B { | |
fn bar(&self) -> T { T::foo(self.b) } | |
} | |
fn main() { | |
let b = B{ b: 0 }; | |
let a : A = b.bar(); | |
core::util::ignore(a); | |
} |
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
~ $ rustc foo.rs | |
foo.rs:12:23: 12:29 error: unresolved name | |
foo.rs:12 fn bar(&self) -> T { T::foo(self.b) } | |
^~~~~~ | |
foo.rs:12:23: 12:29 error: use of undeclared module `T` | |
foo.rs:12 fn bar(&self) -> T { T::foo(self.b) } | |
^~~~~~ | |
foo.rs:12:23: 12:29 error: unresolved name: T::foo | |
foo.rs:12 fn bar(&self) -> T { T::foo(self.b) } | |
^~~~~~ | |
error: aborting due to 3 previous errors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment