2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2012-12-10 11:58:37 -08:00
|
|
|
struct S {
|
2014-05-22 16:57:53 -07:00
|
|
|
x: String
|
2012-12-10 11:58:37 -08:00
|
|
|
}
|
|
|
|
|
2013-05-31 15:17:22 -07:00
|
|
|
impl S {
|
|
|
|
pub fn foo(self) {
|
2013-02-15 02:44:18 -08:00
|
|
|
self.bar();
|
2012-12-10 11:58:37 -08:00
|
|
|
}
|
|
|
|
|
2013-05-31 15:17:22 -07:00
|
|
|
pub fn bar(self) {
|
2014-01-09 21:06:55 +11:00
|
|
|
println!("{}", self.x);
|
2012-12-10 11:58:37 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2014-05-25 03:17:19 -07:00
|
|
|
let x = S { x: "Hello!".to_string() };
|
2012-12-10 11:58:37 -08:00
|
|
|
x.foo();
|
|
|
|
}
|