fn encode_macro_defs(rbml_w: &mut Encoder,
                     krate: &hir::Crate,
                     tcx: TyCtxt) {
    rbml_w.start_tag(tag_macro_defs);
    for def in &krate.exported_macros {
        rbml_w.start_tag(tag_macro_def);

        encode_name(rbml_w, def.name);
        encode_attributes(rbml_w, &def.attrs);
        let &BytePos(lo) = &def.span.lo;
        let &BytePos(hi) = &def.span.hi;
        rbml_w.wr_tagged_u32(tag_macro_def_span_lo, lo);
        rbml_w.wr_tagged_u32(tag_macro_def_span_hi, hi);

        rbml_w.wr_tagged_str(tag_macro_def_body,
                             &::syntax::print::pprust::tts_to_string(&def.body));

        rbml_w.end_tag();
    }
    rbml_w.end_tag();

    if tcx.sess.crate_types.borrow().contains(&CrateTypeRustcMacro) {
        let id = tcx.sess.derive_registrar_fn.get().unwrap();
        let did = tcx.map.local_def_id(id);
        rbml_w.wr_tagged_u32(tag_macro_derive_registrar, did.index.as_u32());
    }
}
/// Serialize the text of the exported macros
Serialize the text of the exported macros
Serialize the text of the exported macros
fn encode_macro_defs(rbml_w: &mut Encoder,
                     krate: &hir::Crate,
                     tcx: TyCtxt) {
    rbml_w.start_tag(tag_macro_defs);
    for def in &krate.exported_macros {
        rbml_w.start_tag(tag_macro_def);
        encode_name(rbml_w, def.name);
        encode_attributes(rbml_w, &def.attrs);
        let &BytePos(lo) = &def.span.lo;
        let &BytePos(hi) = &def.span.hi;
        rbml_w.wr_tagged_u32(tag_macro_def_span_lo, lo);
        rbml_w.wr_tagged_u32(tag_macro_def_span_hi, hi);
        rbml_w.wr_tagged_str(tag_macro_def_body,
                             &::syntax::print::pprust::tts_to_string(&def.body));
        rbml_w.end_tag();
    }
    rbml_w.end_tag();
    if tcx.sess.crate_types.borrow().contains(&CrateTypeRustcMacro) {
        let id = tcx.sess.derive_registrar_fn.get().unwrap();
        let did = tcx.map.local_def_id(id);
        rbml_w.wr_tagged_u32(tag_macro_derive_registrar, did.index.as_u32());
    }
}
fn encode_macro_defs ( rbml_w : & mut Encoder , krate : & hir :: Crate , tcx : TyCtxt ) { rbml_w . start_tag ( tag_macro_defs ) ; for def in & krate . exported_macros { rbml_w . start_tag ( tag_macro_def ) ; encode_name ( rbml_w , def . name ) ; encode_attributes ( rbml_w , & def . attrs ) ; let & BytePos ( lo ) = & def . span . lo ; let & BytePos ( hi ) = & def . span . hi ; rbml_w . wr_tagged_u32 ( tag_macro_def_span_lo , lo ) ; rbml_w . wr_tagged_u32 ( tag_macro_def_span_hi , hi ) ; rbml_w . wr_tagged_str ( tag_macro_def_body , & :: syntax :: print :: pprust :: tts_to_string ( & def . body ) ) ; rbml_w . end_tag ( ) ; } rbml_w . end_tag ( ) ; if tcx . sess . crate_types . borrow ( ) . contains ( & CrateTypeRustcMacro ) { let id = tcx . sess . derive_registrar_fn . get ( ) . unwrap ( ) ; let did = tcx . map . local_def_id ( id ) ; rbml_w . wr_tagged_u32 ( tag_macro_derive_registrar , did . index . as_u32 ( ) ) ; } }
Serialize the text of the exported macros
Serialize the text of the exported macros
rbml_w
&mut Encoder
krate
&hir::Crate
tcx
TyCtxt
rbml_w
&mut Encoder
krate
&hir::Crate
tcx
TyCtxt