EncodeInlinedItem: convert to "unboxed" closures
This commit is contained in:
parent
bd9eef7ac6
commit
0cb34a3609
2 changed files with 4 additions and 5 deletions
|
@ -59,9 +59,8 @@ pub enum InlinedItemRef<'a> {
|
|||
|
||||
pub type Encoder<'a> = writer::Encoder<'a, SeekableMemWriter>;
|
||||
|
||||
pub type EncodeInlinedItem<'a> = |ecx: &EncodeContext,
|
||||
rbml_w: &mut Encoder,
|
||||
ii: InlinedItemRef|: 'a;
|
||||
pub type EncodeInlinedItem<'a> =
|
||||
Box<FnMut(&EncodeContext, &mut Encoder, InlinedItemRef) + 'a>;
|
||||
|
||||
pub struct EncodeParams<'a, 'tcx: 'a> {
|
||||
pub diag: &'a SpanHandler,
|
||||
|
@ -953,7 +952,7 @@ fn encode_inlined_item(ecx: &EncodeContext,
|
|||
ii: InlinedItemRef) {
|
||||
let mut eii = ecx.encode_inlined_item.borrow_mut();
|
||||
let eii: &mut EncodeInlinedItem = &mut *eii;
|
||||
(*eii)(ecx, rbml_w, ii)
|
||||
eii.call_mut((ecx, rbml_w, ii))
|
||||
}
|
||||
|
||||
const FN_FAMILY: char = 'f';
|
||||
|
|
|
@ -2978,7 +2978,7 @@ pub fn write_metadata(cx: &SharedCrateContext, krate: &ast::Crate) -> Vec<u8> {
|
|||
}
|
||||
|
||||
let encode_inlined_item: encoder::EncodeInlinedItem =
|
||||
|ecx, rbml_w, ii| astencode::encode_inlined_item(ecx, rbml_w, ii);
|
||||
box |ecx, rbml_w, ii| astencode::encode_inlined_item(ecx, rbml_w, ii);
|
||||
|
||||
let encode_parms = crate_ctxt_to_encode_parms(cx, encode_inlined_item);
|
||||
let metadata = encoder::encode_metadata(encode_parms, krate);
|
||||
|
|
Loading…
Add table
Reference in a new issue