Skip to content

Commit 6371e75

Browse files
committed
---
yaml --- r: 273655 b: refs/heads/beta c: 0bed9ae h: refs/heads/master i: 273653: 82a82f4 273651: 4e34469 273647: eb16f39
1 parent f9b5cfc commit 6371e75

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 77f0f4a624fbff057514d6ee1bc20cf49145aa50
26+
refs/heads/beta: 0bed9aea2db3ab8338d8fe1ff7583395ceeb1c87
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -532,16 +532,6 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
532532
}
533533
}
534534

535-
/// Ensures that the reduced graph rooted at the given external module
536-
/// is built, building it if it is not.
537-
fn populate_module_if_necessary(&mut self, module: Module<'b>) {
538-
if module.populated.get() { return }
539-
for child in self.session.cstore.item_children(module.def_id().unwrap()) {
540-
self.build_reduced_graph_for_external_crate_def(module, child);
541-
}
542-
module.populated.set(true)
543-
}
544-
545535
/// Builds the reduced graph rooted at the 'use' directive for an external
546536
/// crate.
547537
fn build_reduced_graph_for_external_crate(&mut self, root: Module<'b>) {
@@ -585,6 +575,19 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
585575
}
586576
}
587577

578+
impl<'a, 'tcx> Resolver<'a, 'tcx> {
579+
/// Ensures that the reduced graph rooted at the given external module
580+
/// is built, building it if it is not.
581+
pub fn populate_module_if_necessary(&mut self, module: Module<'a>) {
582+
if module.populated.get() { return }
583+
let mut builder = GraphBuilder { resolver: self };
584+
for child in self.session.cstore.item_children(module.def_id().unwrap()) {
585+
builder.build_reduced_graph_for_external_crate_def(module, child);
586+
}
587+
module.populated.set(true)
588+
}
589+
}
590+
588591
struct BuildReducedGraphVisitor<'a, 'b: 'a, 'tcx: 'b> {
589592
builder: GraphBuilder<'a, 'b, 'tcx>,
590593
parent: Module<'b>,
@@ -617,8 +620,3 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
617620
pub fn build_reduced_graph(resolver: &mut Resolver, krate: &hir::Crate) {
618621
GraphBuilder { resolver: resolver }.build_reduced_graph(krate);
619622
}
620-
621-
pub fn populate_module_if_necessary<'a, 'tcx>(resolver: &mut Resolver<'a, 'tcx>,
622-
module: Module<'a>) {
623-
GraphBuilder { resolver: resolver }.populate_module_if_necessary(module);
624-
}

branches/beta/src/librustc_resolve/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
15421542
-> ResolveResult<&'a NameBinding<'a>> {
15431543
debug!("(resolving name in module) resolving `{}` in `{}`", name, module_to_string(module));
15441544

1545-
build_reduced_graph::populate_module_if_necessary(self, module);
1545+
self.populate_module_if_necessary(module);
15461546
match use_lexical_scope {
15471547
true => module.resolve_name_in_lexical_scope(name, namespace)
15481548
.map(Success).unwrap_or(Failed(None)),
@@ -3363,7 +3363,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
33633363
while let Some((in_module,
33643364
path_segments,
33653365
in_module_is_extern)) = worklist.pop() {
3366-
build_reduced_graph::populate_module_if_necessary(self, &in_module);
3366+
self.populate_module_if_necessary(in_module);
33673367

33683368
in_module.for_each_child(|name, ns, name_binding| {
33693369

branches/beta/src/librustc_resolve/resolve_imports.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ use UseLexicalScopeFlag;
2121
use {names_to_string, module_to_string};
2222
use {resolve_error, ResolutionError};
2323

24-
use build_reduced_graph;
25-
2624
use rustc::lint;
2725
use rustc::middle::def::*;
2826

@@ -610,7 +608,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
610608
let msg = "Cannot glob-import a module into itself.".into();
611609
return Failed(Some((directive.span, msg)));
612610
}
613-
build_reduced_graph::populate_module_if_necessary(self.resolver, target_module);
611+
self.resolver.populate_module_if_necessary(target_module);
614612

615613
if directive.is_prelude {
616614
*module_.prelude.borrow_mut() = Some(target_module);

0 commit comments

Comments
 (0)