2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-06-21 14:29:13 -05:00
|
|
|
struct Foo {
|
|
|
|
a: u32
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
fn x(&mut self) {
|
|
|
|
self.a = 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const FUNC: &'static Fn(&mut Foo) -> () = &Foo::x;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut foo = Foo { a: 137 };
|
2016-08-22 18:51:37 -05:00
|
|
|
FUNC(&mut foo);
|
2015-06-21 14:29:13 -05:00
|
|
|
assert_eq!(foo.a, 5);
|
|
|
|
}
|