Skip to content

Commit 20b6c16

Browse files
committed
Auto merge of #38539 - jseyfried:fix_resolve_hang, r=eddyb
resolve: fix non-termination Fixes #34324. r? @eddyb
2 parents c74ac6c + 098c9b6 commit 20b6c16

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/librustc_resolve/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2931,6 +2931,7 @@ impl<'a> Resolver<'a> {
29312931

29322932
let mut lookup_results = Vec::new();
29332933
let mut worklist = Vec::new();
2934+
let mut seen_modules = FxHashSet();
29342935
worklist.push((self.graph_root, Vec::new(), false));
29352936

29362937
while let Some((in_module,
@@ -2976,7 +2977,7 @@ impl<'a> Resolver<'a> {
29762977
if !in_module_is_extern || name_binding.vis == ty::Visibility::Public {
29772978
// add the module to the lookup
29782979
let is_extern = in_module_is_extern || name_binding.is_extern_crate();
2979-
if !worklist.iter().any(|&(m, ..)| m.def() == module.def()) {
2980+
if seen_modules.insert(module.def_id().unwrap()) {
29802981
worklist.push((module, path_segments, is_extern));
29812982
}
29822983
}

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

+3-1
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)