Closed
Description
I tried to do this:
struct S {
x : uint,
func : fn(uint)
}
impl S {
fn no_func(val : uint) { println!("{}", val); }
fn new() -> S {
S { x : 0, func : S::no_func }
}
}
fn main() {
let s : S = S::new();
s.func(7);
}
And I got the error:
error: type
Sdoes not implement any method in scope named "func"
It seems to try to look for a member function and ignore the member variable. One person(alexchandel) in the rust irc channel said this was a bug and should work, another(p1start) said the error message should be improved.