diff options
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index 24ba7dbe9..66d9396aa 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -561,26 +561,30 @@ impl DefCollector<'_> { | |||
561 | fn resolve_imports(&mut self) -> ReachedFixedPoint { | 561 | fn resolve_imports(&mut self) -> ReachedFixedPoint { |
562 | let mut res = ReachedFixedPoint::Yes; | 562 | let mut res = ReachedFixedPoint::Yes; |
563 | let imports = std::mem::replace(&mut self.unresolved_imports, Vec::new()); | 563 | let imports = std::mem::replace(&mut self.unresolved_imports, Vec::new()); |
564 | for mut directive in imports { | 564 | let imports = imports |
565 | directive.status = self.resolve_import(directive.module_id, &directive.import); | 565 | .into_iter() |
566 | match directive.status { | 566 | .filter_map(|mut directive| { |
567 | PartialResolvedImport::Indeterminate(_) => { | 567 | directive.status = self.resolve_import(directive.module_id, &directive.import); |
568 | self.record_resolved_import(&directive); | 568 | match directive.status { |
569 | // FIXME: For avoid performance regression, | 569 | PartialResolvedImport::Indeterminate(_) => { |
570 | // we consider an imported resolved if it is indeterminate (i.e not all namespace resolved) | 570 | self.record_resolved_import(&directive); |
571 | self.resolved_imports.push(directive); | 571 | // FIXME: For avoid performance regression, |
572 | res = ReachedFixedPoint::No; | 572 | // we consider an imported resolved if it is indeterminate (i.e not all namespace resolved) |
573 | } | 573 | self.resolved_imports.push(directive); |
574 | PartialResolvedImport::Resolved(_) => { | 574 | res = ReachedFixedPoint::No; |
575 | self.record_resolved_import(&directive); | 575 | None |
576 | self.resolved_imports.push(directive); | 576 | } |
577 | res = ReachedFixedPoint::No; | 577 | PartialResolvedImport::Resolved(_) => { |
578 | } | 578 | self.record_resolved_import(&directive); |
579 | PartialResolvedImport::Unresolved => { | 579 | self.resolved_imports.push(directive); |
580 | self.unresolved_imports.push(directive); | 580 | res = ReachedFixedPoint::No; |
581 | None | ||
582 | } | ||
583 | PartialResolvedImport::Unresolved => Some(directive), | ||
581 | } | 584 | } |
582 | } | 585 | }) |
583 | } | 586 | .collect(); |
587 | self.unresolved_imports = imports; | ||
584 | res | 588 | res |
585 | } | 589 | } |
586 | 590 | ||