Skip to content

Commit 28f70d3

Browse files
committed
Fix decoding of unboxed closure kinds
Closes rust-lang#18378. Note that cross-crate unboxed closures are still unimplemented and will fail to work currently.
1 parent 3327ecc commit 28f70d3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/librustc/middle/astencode.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1756,12 +1756,14 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> {
17561756
"FnMutUnboxedClosureKind",
17571757
"FnOnceUnboxedClosureKind"
17581758
];
1759-
let kind = self.read_enum_variant(variants, |_, i| {
1760-
Ok(match i {
1761-
0 => ty::FnUnboxedClosureKind,
1762-
1 => ty::FnMutUnboxedClosureKind,
1763-
2 => ty::FnOnceUnboxedClosureKind,
1764-
_ => panic!("bad enum variant for ty::UnboxedClosureKind"),
1759+
let kind = self.read_enum("UnboxedClosureKind", |this| {
1760+
this.read_enum_variant(variants, |_, i| {
1761+
Ok(match i {
1762+
0 => ty::FnUnboxedClosureKind,
1763+
1 => ty::FnMutUnboxedClosureKind,
1764+
2 => ty::FnOnceUnboxedClosureKind,
1765+
_ => panic!("bad enum variant for ty::UnboxedClosureKind"),
1766+
})
17651767
})
17661768
}).unwrap();
17671769
ty::UnboxedClosure {

0 commit comments

Comments
 (0)