Skip to content

Commit 781dc7c

Browse files
committed
---
yaml --- r: 211055 b: refs/heads/try c: fb7c0b4 h: refs/heads/master i: 211053: 7c9973f 211051: 0ba01db 211047: acf3dc7 211039: 855df8b v: v3
1 parent ee94870 commit 781dc7c

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: de9deefb22519c2cd2233f517199c127c935250e
5+
refs/heads/try: fb7c0b44bb8dd47de07a05d6a17813dd614e3dff
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/librbml/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,10 @@ pub mod reader {
397397
}
398398
}
399399

400-
pub fn docs<F>(d: Doc, mut it: F) -> bool where
401-
F: FnMut(usize, Doc) -> bool,
402-
{
403-
DocsIterator { d: d }.all(|(value, doc)| {
404-
it(value, doc)
405-
})
400+
pub fn docs<'a>(d: Doc<'a>) -> DocsIterator<'a> {
401+
DocsIterator {
402+
d: d
403+
}
406404
}
407405

408406
pub struct DocsIterator<'a> {

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,25 +275,18 @@ fn enum_variant_ids(item: rbml::Doc, cdata: Cmd) -> Vec<ast::DefId> {
275275

276276
fn item_path(item_doc: rbml::Doc) -> Vec<ast_map::PathElem> {
277277
let path_doc = reader::get_doc(item_doc, tag_path);
278-
279-
let len_doc = reader::get_doc(path_doc, tag_path_len);
280-
let len = reader::doc_as_u32(len_doc) as usize;
281-
282-
let mut result = Vec::with_capacity(len);
283-
reader::docs(path_doc, |tag, elt_doc| {
278+
reader::docs(path_doc).filter_map(|(tag, elt_doc)| {
284279
if tag == tag_path_elem_mod {
285280
let s = elt_doc.as_str_slice();
286-
result.push(ast_map::PathMod(token::intern(s)));
281+
Some(ast_map::PathMod(token::intern(s)))
287282
} else if tag == tag_path_elem_name {
288283
let s = elt_doc.as_str_slice();
289-
result.push(ast_map::PathName(token::intern(s)));
284+
Some(ast_map::PathName(token::intern(s)))
290285
} else {
291286
// ignore tag_path_len element
287+
None
292288
}
293-
true
294-
});
295-
296-
result
289+
}).collect()
297290
}
298291

299292
fn item_name(intr: &IdentInterner, item: rbml::Doc) -> ast::Name {

branches/try/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
17061706
fn decode_side_tables(dcx: &DecodeContext,
17071707
ast_doc: rbml::Doc) {
17081708
let tbl_doc = ast_doc.get(c::tag_table as usize);
1709-
reader::docs(tbl_doc, |tag, entry_doc| {
1709+
for (tag, entry_doc) in reader::docs(tbl_doc) {
17101710
let mut entry_dsr = reader::Decoder::new(entry_doc);
17111711
let id0: ast::NodeId = Decodable::decode(&mut entry_dsr).unwrap();
17121712
let id = dcx.tr_id(id0);
@@ -1815,8 +1815,7 @@ fn decode_side_tables(dcx: &DecodeContext,
18151815
}
18161816

18171817
debug!(">< Side table doc loaded");
1818-
true
1819-
});
1818+
}
18201819
}
18211820

18221821
// ______________________________________________________________________

0 commit comments

Comments
 (0)