Omitting enum variant fields other than the last doesn't work
Manishearth opened this issue · comments
Manish Goregaokar commented
Essentially, the following code:
#[derive(Finalize, Trace)]
enum Foo {
Foo(bool, #[unsafe_ignore_trace] Ignore),
Bar(#[unsafe_ignore_trace] Ignore, bool),
}
using filter()
on unsafe_ignore_trace
will generate the following function:
unsafe fn trace(&self) {
#[allow(dead_code)]
#[inline]
unsafe fn mark<T: ::gc::Trace + ?Sized>(it: &T) {
::gc::Trace::trace(it);
}
match *self {
Foo::Foo(ref __binding_0, ..) => { { mark(__binding_0) } }
Foo::Bar(ref __binding_1, ..) => { { mark(__binding_1) } }
}
}
Note that the bindings are appropriately numbered, but appropriate gaps are not inserted in the enum pattern match.
Manish Goregaokar commented