2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2019-07-26 21:54:25 +00:00
|
|
|
|
2018-09-14 10:20:28 +00:00
|
|
|
#![allow(dead_code)]
|
2012-12-17 22:57:37 +00:00
|
|
|
|
2012-10-08 19:39:30 +00:00
|
|
|
trait Foo {
|
2013-03-13 02:32:14 +00:00
|
|
|
fn f(&self) {
|
2014-01-09 10:06:55 +00:00
|
|
|
println!("Hello!");
|
2012-10-08 19:39:30 +00:00
|
|
|
self.g();
|
|
|
|
}
|
2013-03-13 02:32:14 +00:00
|
|
|
fn g(&self);
|
2012-10-08 19:39:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct A {
|
2015-03-26 00:06:52 +00:00
|
|
|
x: isize
|
2012-10-08 19:39:30 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 19:47:00 +00:00
|
|
|
impl Foo for A {
|
2013-03-13 02:32:14 +00:00
|
|
|
fn g(&self) {
|
2014-01-09 10:06:55 +00:00
|
|
|
println!("Goodbye!");
|
2012-10-08 19:39:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2012-10-08 19:39:30 +00:00
|
|
|
let a = A { x: 1 };
|
|
|
|
a.f();
|
|
|
|
}
|