Skip to content

Commit

Permalink
Fix decoding of unboxed closure kinds
Browse files Browse the repository at this point in the history
Closes #18378.  Note that cross-crate unboxed closures are
still unimplemented and will fail to work currently.
  • Loading branch information
bkoropoff committed Nov 2, 2014
1 parent 3327ecc commit 28f70d3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/librustc/middle/astencode.rs
Expand Up @@ -1756,12 +1756,14 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> {
"FnMutUnboxedClosureKind",
"FnOnceUnboxedClosureKind"
];
let kind = self.read_enum_variant(variants, |_, i| {
Ok(match i {
0 => ty::FnUnboxedClosureKind,
1 => ty::FnMutUnboxedClosureKind,
2 => ty::FnOnceUnboxedClosureKind,
_ => panic!("bad enum variant for ty::UnboxedClosureKind"),
let kind = self.read_enum("UnboxedClosureKind", |this| {
this.read_enum_variant(variants, |_, i| {
Ok(match i {
0 => ty::FnUnboxedClosureKind,
1 => ty::FnMutUnboxedClosureKind,
2 => ty::FnOnceUnboxedClosureKind,
_ => panic!("bad enum variant for ty::UnboxedClosureKind"),
})
})
}).unwrap();
ty::UnboxedClosure {
Expand Down

0 comments on commit 28f70d3

Please sign in to comment.