Skip to content

Commit fad1423

Browse files
committed
Adjust metadata for new fields and enum variants. Yawn.
1 parent 2a43b35 commit fad1423

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

src/librustc/metadata/tydecode.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,11 @@ fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
453453
return ty::mk_closure(st.tcx, parse_closure_ty(st, |x,y| conv(x,y)));
454454
}
455455
'F' => {
456-
return ty::mk_bare_fn(st.tcx, parse_bare_fn_ty(st, |x,y| conv(x,y)));
456+
let def_id = parse_def(st, NominalType, |x,y| conv(x,y));
457+
return ty::mk_bare_fn(st.tcx, Some(def_id), parse_bare_fn_ty(st, |x,y| conv(x,y)));
458+
}
459+
'G' => {
460+
return ty::mk_bare_fn(st.tcx, None, parse_bare_fn_ty(st, |x,y| conv(x,y)));
457461
}
458462
'#' => {
459463
let pos = parse_hex(st);

src/librustc/metadata/tyencode.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,13 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
123123
mywrite!(w, "f");
124124
enc_closure_ty(w, cx, &**f);
125125
}
126-
ty::ty_bare_fn(ref f) => {
126+
ty::ty_bare_fn(Some(def_id), ref f) => {
127127
mywrite!(w, "F");
128+
mywrite!(w, "{}|", (cx.ds)(def_id));
129+
enc_bare_fn_ty(w, cx, f);
130+
}
131+
ty::ty_bare_fn(None, ref f) => {
132+
mywrite!(w, "G");
128133
enc_bare_fn_ty(w, cx, f);
129134
}
130135
ty::ty_infer(_) => {

src/librustc/middle/astencode.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,14 +1007,21 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
10071007

10081008
self.emit_enum("AutoAdjustment", |this| {
10091009
match *adj {
1010-
ty::AdjustAddEnv(store) => {
1011-
this.emit_enum_variant("AutoAddEnv", 0, 1, |this| {
1012-
this.emit_enum_variant_arg(0, |this| store.encode(this))
1010+
ty::AdjustAddEnv(def_id, store) => {
1011+
this.emit_enum_variant("AdjustAddEnv", 0, 2, |this| {
1012+
this.emit_enum_variant_arg(0, |this| def_id.encode(this));
1013+
this.emit_enum_variant_arg(1, |this| store.encode(this))
1014+
})
1015+
}
1016+
1017+
ty::AdjustReifyFnPointer(def_id) => {
1018+
this.emit_enum_variant("AdjustReifyFnPointer", 1, 2, |this| {
1019+
this.emit_enum_variant_arg(0, |this| def_id.encode(this))
10131020
})
10141021
}
10151022

10161023
ty::AdjustDerefRef(ref auto_deref_ref) => {
1017-
this.emit_enum_variant("AutoDerefRef", 1, 1, |this| {
1024+
this.emit_enum_variant("AdjustDerefRef", 2, 2, |this| {
10181025
this.emit_enum_variant_arg(0,
10191026
|this| Ok(this.emit_auto_deref_ref(ecx, auto_deref_ref)))
10201027
})
@@ -1648,12 +1655,20 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
16481655
this.read_enum_variant(&variants, |this, i| {
16491656
Ok(match i {
16501657
0 => {
1658+
let def_id: ast::DefId =
1659+
this.read_def_id(dcx);
16511660
let store: ty::TraitStore =
16521661
this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap();
16531662

1654-
ty::AdjustAddEnv(store.tr(dcx))
1663+
ty::AdjustAddEnv(def_id, store.tr(dcx))
16551664
}
16561665
1 => {
1666+
let def_id: ast::DefId =
1667+
this.read_def_id(dcx);
1668+
1669+
ty::AdjustReifyFnPointer(def_id)
1670+
}
1671+
2 => {
16571672
let auto_deref_ref: ty::AutoDerefRef =
16581673
this.read_enum_variant_arg(0,
16591674
|this| Ok(this.read_auto_deref_ref(dcx))).unwrap();

0 commit comments

Comments
 (0)