Skip to content

Commit b27410f

Browse files
jseyfriedalexcrichton
authored andcommitted
Fix non-termination in resolve.
1 parent cb6ecf0 commit b27410f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/librustc_resolve/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2946,6 +2946,7 @@ impl<'a> Resolver<'a> {
29462946

29472947
let mut lookup_results = Vec::new();
29482948
let mut worklist = Vec::new();
2949+
let mut seen_modules = FxHashSet();
29492950
worklist.push((self.graph_root, Vec::new(), false));
29502951

29512952
while let Some((in_module,
@@ -3001,7 +3002,7 @@ impl<'a> Resolver<'a> {
30013002
if !in_module_is_extern || name_binding.vis == ty::Visibility::Public {
30023003
// add the module to the lookup
30033004
let is_extern = in_module_is_extern || name_binding.is_extern_crate();
3004-
if !worklist.iter().any(|&(m, ..)| m.def() == module.def()) {
3005+
if seen_modules.insert(module.def_id().unwrap()) {
30053006
worklist.push((module, path_segments, is_extern));
30063007
}
30073008
}

src/test/compile-fail/recursive-reexports.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// aux-build:recursive_reexports.rs
1212

13-
fn f() -> recursive_reexports::S {} //~ ERROR undeclared
13+
extern crate recursive_reexports;
14+
15+
fn f() -> recursive_reexports::S {} //~ ERROR type name `recursive_reexports::S` is undefined
1416

1517
fn main() {}

0 commit comments

Comments
 (0)