Skip to content

Commit a47f4eb

Browse files
committed
---
yaml --- r: 63077 b: refs/heads/snap-stage3 c: 9b37439 h: refs/heads/master i: 63075: 59abfba v: v3
1 parent 017a0cc commit a47f4eb

File tree

14 files changed

+381
-297
lines changed

14 files changed

+381
-297
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 6d5beda6772230d8ec0e5e4b9e561100acf81a6f
4+
refs/heads/snap-stage3: 9b3743938d2dde1f33ddfba71ff3f5b79a0559dd
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/metadata/decoder.rs

Lines changed: 70 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -476,103 +476,91 @@ pub fn each_lang_item(cdata: cmd, f: &fn(ast::node_id, uint) -> bool) -> bool {
476476
}
477477

478478
/// Iterates over all the paths in the given crate.
479-
pub fn _each_path(intr: @ident_interner,
480-
cdata: cmd,
481-
get_crate_data: GetCrateDataCb,
482-
f: &fn(&str, def_like, ast::visibility) -> bool)
483-
-> bool {
479+
pub fn each_path(intr: @ident_interner,
480+
cdata: cmd,
481+
get_crate_data: GetCrateDataCb,
482+
f: &fn(&str, def_like, ast::visibility) -> bool)
483+
-> bool {
484+
// FIXME #4572: This function needs to be nuked, as it's impossible to make fast.
485+
// It's the source of most of the performance problems when compiling small crates.
486+
484487
let root = reader::Doc(cdata.data);
485488
let items = reader::get_doc(root, tag_items);
486489
let items_data = reader::get_doc(items, tag_items_data);
487490

488-
let mut broken = false;
489-
490491
// First, go through all the explicit items.
491492
for reader::tagged_docs(items_data, tag_items_data_item) |item_doc| {
492-
if !broken {
493-
let path = ast_map::path_to_str_with_sep(
494-
item_path(item_doc), "::", intr);
495-
let path_is_empty = path.is_empty();
496-
if !path_is_empty {
497-
// Extract the def ID.
498-
let def_id = item_def_id(item_doc, cdata);
499-
500-
// Construct the def for this item.
501-
debug!("(each_path) yielding explicit item: %s", path);
502-
let def_like = item_to_def_like(item_doc, def_id, cdata.cnum);
503-
504-
let vis = item_visibility(item_doc);
505-
506-
// Hand the information off to the iteratee.
507-
if !f(path, def_like, vis) {
508-
broken = true; // FIXME #4572: This is awful.
509-
}
493+
let path = ast_map::path_to_str(item_path(item_doc), intr);
494+
let path_is_empty = path.is_empty();
495+
if !path_is_empty {
496+
// Extract the def ID.
497+
let def_id = item_def_id(item_doc, cdata);
498+
499+
// Construct the def for this item.
500+
debug!("(each_path) yielding explicit item: %s", path);
501+
let def_like = item_to_def_like(item_doc, def_id, cdata.cnum);
502+
503+
let vis = item_visibility(item_doc);
504+
505+
// Hand the information off to the iteratee.
506+
if !f(path, def_like, vis) {
507+
return false;
510508
}
509+
}
511510

512-
// If this is a module, find the reexports.
513-
for each_reexport(item_doc) |reexport_doc| {
514-
if !broken {
515-
let def_id_doc =
516-
reader::get_doc(reexport_doc,
517-
tag_items_data_item_reexport_def_id);
518-
let def_id =
519-
reader::with_doc_data(def_id_doc,
520-
|d| parse_def_id(d));
521-
let def_id = translate_def_id(cdata, def_id);
522-
523-
let reexport_name_doc =
524-
reader::get_doc(reexport_doc,
525-
tag_items_data_item_reexport_name);
526-
let reexport_name = reader::doc_as_str(reexport_name_doc);
527-
528-
let reexport_path;
529-
if path_is_empty {
530-
reexport_path = reexport_name;
531-
} else {
532-
reexport_path = path + "::" + reexport_name;
533-
}
511+
// If this is a module, find the reexports.
512+
for each_reexport(item_doc) |reexport_doc| {
513+
let def_id_doc =
514+
reader::get_doc(reexport_doc,
515+
tag_items_data_item_reexport_def_id);
516+
let def_id =
517+
reader::with_doc_data(def_id_doc,
518+
|d| parse_def_id(d));
519+
let def_id = translate_def_id(cdata, def_id);
520+
521+
let reexport_name_doc =
522+
reader::get_doc(reexport_doc,
523+
tag_items_data_item_reexport_name);
524+
let reexport_name = reader::doc_as_str(reexport_name_doc);
525+
526+
let reexport_path;
527+
if path_is_empty {
528+
reexport_path = reexport_name;
529+
} else {
530+
reexport_path = path + "::" + reexport_name;
531+
}
534532

535-
// This reexport may be in yet another crate
536-
let other_crates_items = if def_id.crate == cdata.cnum {
537-
items
538-
} else {
539-
let crate_data = get_crate_data(def_id.crate);
540-
let root = reader::Doc(crate_data.data);
541-
reader::get_doc(root, tag_items)
542-
};
543-
544-
// Get the item.
545-
match maybe_find_item(def_id.node, other_crates_items) {
546-
None => {}
547-
Some(item_doc) => {
548-
// Construct the def for this item.
549-
let def_like = item_to_def_like(item_doc,
550-
def_id,
551-
cdata.cnum);
552-
553-
// Hand the information off to the iteratee.
554-
debug!("(each_path) yielding reexported \
555-
item: %s", reexport_path);
556-
557-
if (!f(reexport_path, def_like, ast::public)) {
558-
broken = true; // FIXME #4572: This is awful.
559-
}
560-
}
533+
// This reexport may be in yet another crate
534+
let other_crates_items = if def_id.crate == cdata.cnum {
535+
items
536+
} else {
537+
let crate_data = get_crate_data(def_id.crate);
538+
let root = reader::Doc(crate_data.data);
539+
reader::get_doc(root, tag_items)
540+
};
541+
542+
// Get the item.
543+
match maybe_find_item(def_id.node, other_crates_items) {
544+
None => {}
545+
Some(item_doc) => {
546+
// Construct the def for this item.
547+
let def_like = item_to_def_like(item_doc,
548+
def_id,
549+
cdata.cnum);
550+
551+
// Hand the information off to the iteratee.
552+
debug!("(each_path) yielding reexported \
553+
item: %s", reexport_path);
554+
555+
if (!f(reexport_path, def_like, ast::public)) {
556+
return false;
561557
}
562558
}
563559
}
564560
}
565561
}
566562

567-
return broken;
568-
}
569-
570-
pub fn each_path(intr: @ident_interner,
571-
cdata: cmd,
572-
get_crate_data: GetCrateDataCb,
573-
f: &fn(&str, def_like, ast::visibility) -> bool)
574-
-> bool {
575-
_each_path(intr, cdata, get_crate_data, f)
563+
return true;
576564
}
577565

578566
pub fn get_item_path(cdata: cmd, id: ast::node_id)

branches/snap-stage3/src/libsyntax/ext/deriving/clone.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ pub fn expand_deriving_clone(cx: @ExtCtxt,
3838
]
3939
};
4040

41-
trait_def.expand(cx, span, mitem, in_items)
41+
expand_deriving_generic(cx, span,
42+
mitem, in_items,
43+
&trait_def)
4244
}
4345

4446
pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
@@ -65,7 +67,9 @@ pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
6567
]
6668
};
6769

68-
trait_def.expand(cx, span, mitem, in_items)
70+
expand_deriving_generic(cx, span,
71+
mitem, in_items,
72+
&trait_def)
6973
}
7074

7175
fn cs_clone(

branches/snap-stage3/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@ pub fn expand_deriving_eq(cx: @ExtCtxt,
5454
md!("ne", cs_ne)
5555
]
5656
};
57-
trait_def.expand(cx, span, mitem, in_items)
57+
58+
expand_deriving_generic(cx, span, mitem, in_items,
59+
&trait_def)
5860
}

branches/snap-stage3/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ pub fn expand_deriving_ord(cx: @ExtCtxt,
4949
md!("ge", false, true)
5050
]
5151
};
52-
trait_def.expand(cx, span, mitem, in_items)
52+
53+
expand_deriving_generic(cx, span, mitem, in_items,
54+
&trait_def)
5355
}
5456

5557
/// `less`: is this `lt` or `le`? `equal`: is this `le` or `ge`?

branches/snap-stage3/src/libsyntax/ext/deriving/cmp/totaleq.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@ pub fn expand_deriving_totaleq(cx: @ExtCtxt,
4242
}
4343
]
4444
};
45-
trait_def.expand(cx, span, mitem, in_items)
45+
46+
expand_deriving_generic(cx, span, mitem, in_items,
47+
&trait_def)
4648
}

branches/snap-stage3/src/libsyntax/ext/deriving/cmp/totalord.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt,
3838
]
3939
};
4040

41-
trait_def.expand(cx, span, mitem, in_items)
41+
expand_deriving_generic(cx, span, mitem, in_items,
42+
&trait_def)
4243
}
4344

4445

branches/snap-stage3/src/libsyntax/ext/deriving/decodable.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ pub fn expand_deriving_decodable(cx: @ExtCtxt,
4949
]
5050
};
5151

52-
trait_def.expand(cx, span, mitem, in_items)
52+
expand_deriving_generic(cx, span, mitem, in_items,
53+
&trait_def)
5354
}
5455

5556
fn decodable_substructure(cx: @ExtCtxt, span: span,

branches/snap-stage3/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ pub fn expand_deriving_encodable(cx: @ExtCtxt,
109109
]
110110
};
111111

112-
trait_def.expand(cx, span, mitem, in_items)
112+
expand_deriving_generic(cx, span, mitem, in_items,
113+
&trait_def)
113114
}
114115

115116
fn encodable_substructure(cx: @ExtCtxt, span: span,

0 commit comments

Comments
 (0)