Closed zrneely closed 9 years ago
Inlining the code so it doesn't get lost
macro_rules! get_method {
( $x: ident ) => {
&Foo::$x
};
}
struct Foo {
a: u32
}
impl Foo {
fn x(&mut self) {
self.a = 5;
}
}
const FUNC: &'static FnMut(&mut Foo) -> () = get_method!(x);
fn main() {}
Update: it appears this bug is unrelated to macros, as it still occurs in the following code:
struct Foo {
a: u32
}
impl Foo {
fn x(&mut self) {
self.a = 5;
}
}
const FUNC: &'static FnMut(&mut Foo) -> () = &Foo::x;
fn main() {}
Is this intended to be possible?
When I tried to compile my project, rustc panicked.
I put together a playpen that reproduces the issue (on stable, beta, or nightly, in debug or release mode), but I'm not sure where exactly the issue stems from. Side note - I was experimenting with macros for the first time, so the code is probably pretty bad anyway.
http://is.gd/EsBJsA
Here's the backtrace from my actual project: