We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f51d30d + a02a759 commit b95c135Copy full SHA for b95c135
src/test/run-pass/issue-7563.rs
@@ -0,0 +1,25 @@
1
+trait IDummy {
2
+ fn do_nothing(&self);
3
+}
4
+
5
+struct A { a: int }
6
+struct B<'self> { b: int, pa: &'self A }
7
8
+ impl IDummy for A {
9
+ fn do_nothing(&self) {
10
+ println("A::do_nothing() is called");
11
+ }
12
13
14
+impl<'self> B<'self> {
15
+ fn get_pa(&self) -> &'self IDummy { self.pa as &'self IDummy }
16
17
18
+pub fn main() {
19
+ let sa = A { a: 100 };
20
+ let sb = B { b: 200, pa: &sa };
21
22
+ debug!("sa is %?", sa);
23
+ debug!("sb is %?", sb);
24
+ debug!("sb.pa is %?", sb.get_pa());
25
0 commit comments