Fix decoding of unboxed closure kinds

Closes #18378.  Note that cross-crate unboxed closures are
still unimplemented and will fail to work currently.
This commit is contained in:
Brian Koropoff
2014-11-02 00:16:38 -07:00
parent 3327ecca42
commit 28f70d3440

View File

@@ -1756,13 +1756,15 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> {
"FnMutUnboxedClosureKind", "FnMutUnboxedClosureKind",
"FnOnceUnboxedClosureKind" "FnOnceUnboxedClosureKind"
]; ];
let kind = self.read_enum_variant(variants, |_, i| { let kind = self.read_enum("UnboxedClosureKind", |this| {
this.read_enum_variant(variants, |_, i| {
Ok(match i { Ok(match i {
0 => ty::FnUnboxedClosureKind, 0 => ty::FnUnboxedClosureKind,
1 => ty::FnMutUnboxedClosureKind, 1 => ty::FnMutUnboxedClosureKind,
2 => ty::FnOnceUnboxedClosureKind, 2 => ty::FnOnceUnboxedClosureKind,
_ => panic!("bad enum variant for ty::UnboxedClosureKind"), _ => panic!("bad enum variant for ty::UnboxedClosureKind"),
}) })
})
}).unwrap(); }).unwrap();
ty::UnboxedClosure { ty::UnboxedClosure {
closure_type: closure_type, closure_type: closure_type,