From 28f70d34400959cd2e0095d019b53dba244b900b Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Sun, 2 Nov 2014 00:16:38 -0700 Subject: [PATCH] Fix decoding of unboxed closure kinds Closes #18378. Note that cross-crate unboxed closures are still unimplemented and will fail to work currently. --- src/librustc/middle/astencode.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 3d2bd763a14..692a815c63c 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -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 {