Skip to content

Commit 9d7e4ae

Browse files
committed
Add enough tyencode stuff to stop faulting when we hit error messages.
1 parent aeca5ba commit 9d7e4ae

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

src/rustc/metadata/tydecode.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import syntax::ast_util;
66
import syntax::ast_util::respan;
77
import middle::ty;
88
import std::map::hashmap;
9+
import driver::session;
10+
import session::session;
911

1012
export parse_ty_data, parse_def_id, parse_ident;
1113
export parse_bounds_data;
@@ -176,6 +178,10 @@ fn parse_proto(c: char) -> ast::proto {
176178
}
177179
}
178180

181+
fn parse_vstore(st: @pstate) -> ty::vstore {
182+
st.tcx.sess.unimpl("tydecode::parse_vstore");
183+
}
184+
179185
fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
180186
alt check next(st) {
181187
'n' { ret ty::mk_nil(st.tcx); }
@@ -231,6 +237,15 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
231237
'~' { ret ty::mk_uniq(st.tcx, parse_mt(st, conv)); }
232238
'*' { ret ty::mk_ptr(st.tcx, parse_mt(st, conv)); }
233239
'I' { ret ty::mk_vec(st.tcx, parse_mt(st, conv)); }
240+
'V' {
241+
let mt = parse_mt(st, conv);
242+
let v = parse_vstore(st);
243+
ret ty::mk_evec(st.tcx, mt, v);
244+
}
245+
'v' {
246+
let v = parse_vstore(st);
247+
ret ty::mk_estr(st.tcx, v);
248+
}
234249
'R' {
235250
assert (next(st) == '[');
236251
let mut fields: [ty::field] = [];

src/rustc/metadata/tyencode.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,27 @@ fn enc_region(w: io::writer, r: ty::region) {
145145
}
146146
}
147147
}
148+
149+
fn enc_vstore(w: io::writer, v: ty::vstore) {
150+
w.write_char('/');
151+
alt v {
152+
ty::vstore_fixed(u) {
153+
w.write_uint(u);
154+
w.write_char('|');
155+
}
156+
ty::vstore_uniq {
157+
w.write_char('~');
158+
}
159+
ty::vstore_box {
160+
w.write_char('@');
161+
}
162+
ty::vstore_slice(r) {
163+
w.write_char('&');
164+
enc_region(w, r);
165+
}
166+
}
167+
}
168+
148169
fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
149170
alt st {
150171
ty::ty_nil { w.write_char('n'); }
@@ -176,7 +197,6 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
176197
ty_f64 { w.write_str("MF"); }
177198
}
178199
}
179-
ty::ty_estr(_) { cx.tcx.sess.unimpl("tyencode::enc_sty on estr"); }
180200
ty::ty_str { w.write_char('S'); }
181201
ty::ty_enum(def, tys) {
182202
w.write_str("t[");
@@ -205,7 +225,15 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
205225
enc_region(w, r);
206226
enc_mt(w, cx, mt);
207227
}
208-
ty::ty_evec(_, _) { cx.tcx.sess.unimpl("tyencode::enc_sty on evec"); }
228+
ty::ty_evec(mt, v) {
229+
w.write_char('V');
230+
enc_mt(w, cx, mt);
231+
enc_vstore(w, v);
232+
}
233+
ty::ty_estr(v) {
234+
w.write_char('v');
235+
enc_vstore(w, v);
236+
}
209237
ty::ty_vec(mt) { w.write_char('I'); enc_mt(w, cx, mt); }
210238
ty::ty_rec(fields) {
211239
w.write_str("R[");

0 commit comments

Comments
 (0)