Skip to content

Commit b95c135

Browse files
committed
auto merge of #8620 : brson/rust/issue-7563, r=alexcrichton
2 parents f51d30d + a02a759 commit b95c135

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: src/test/run-pass/issue-7563.rs

+25
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)