Skip to content

Commit 42e645c

Browse files
committed
Patch more metadata decoding problems.
1 parent 30e8ab0 commit 42e645c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/librustc/metadata/decoder.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ fn item_visibility(item: rbml::Doc) -> ast::Visibility {
172172
}
173173

174174
fn item_sort(item: rbml::Doc) -> char {
175-
// NB(pcwalton): The default of 'r' here is relied upon in
176-
// `is_associated_type` below.
177-
let mut ret = 'r';
175+
let mut ret = None;
178176
reader::tagged_docs(item, tag_item_trait_item_sort, |doc| {
179-
ret = doc.as_str_slice().as_bytes()[0] as char;
177+
ret = Some(doc.as_str_slice().as_bytes()[0] as char);
180178
false
181179
});
182-
ret
180+
match ret {
181+
Some(r) => r,
182+
None => panic!("No item_sort found")
183+
}
183184
}
184185

185186
fn item_symbol(item: rbml::Doc) -> String {

src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ fn encode_info_for_associated_type(ecx: &EncodeContext,
898898
encode_visibility(rbml_w, associated_type.vis);
899899
encode_family(rbml_w, 'y');
900900
encode_parent_item(rbml_w, local_def(parent_id));
901-
encode_item_sort(rbml_w, 'r');
901+
encode_item_sort(rbml_w, 't');
902902

903903
let stab = stability::lookup(ecx.tcx, associated_type.def_id);
904904
encode_stability(rbml_w, stab);
@@ -1404,6 +1404,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
14041404
encode_path(rbml_w,
14051405
path.clone().chain(Some(elem).into_iter()));
14061406

1407+
encode_item_sort(rbml_w, 't');
14071408
encode_family(rbml_w, 'y');
14081409

14091410
is_nonstatic_method = false;

0 commit comments

Comments
 (0)