We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53b181d commit 593f414Copy full SHA for 593f414
src/test/run-pass/trait-inheritance-self.rs
@@ -0,0 +1,29 @@
1
+trait Foo<T> {
2
+ fn f(&self, x: &T);
3
+}
4
+
5
+trait Bar : Foo<self> {
6
+ fn g(&self);
7
8
9
+struct S {
10
+ x: int
11
12
13
+impl S : Foo<S> {
14
+ fn f(&self, x: &S) {
15
+ io::println(x.x.to_str());
16
+ }
17
18
19
+impl S : Bar {
20
+ fn g(&self) {
21
+ self.f(self);
22
23
24
25
+fn main() {
26
+ let s = S { x: 1 };
27
+ s.g();
28
29
0 commit comments