aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-09-17 19:04:15 +0100
committerAleksey Kladov <[email protected]>2019-09-17 19:04:15 +0100
commit2890a1450ad4aa54362c6783c790422db193108c (patch)
tree40d561575c5375543270029ffbf240c9eacc710b /crates/ra_hir/src/nameres
parent9ad2cea25113befd4988785b98f92a6260969dfe (diff)
remove confusing code
I must confess I don't really understand what this code is trying to do, but it definitely misreports changes during fixedpoint iteration, and no tests fail if I remove it, so...
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r--crates/ra_hir/src/nameres/collector.rs32
1 files changed, 1 insertions, 31 deletions
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs
index 1446c49a0..a6b9b41d0 100644
--- a/crates/ra_hir/src/nameres/collector.rs
+++ b/crates/ra_hir/src/nameres/collector.rs
@@ -114,7 +114,7 @@ where
114 _ => i += 1, 114 _ => i += 1,
115 } 115 }
116 if i == 1000 { 116 if i == 1000 {
117 log::error!("diverging name resolution"); 117 log::error!("name resolution is stuck");
118 break; 118 break;
119 } 119 }
120 } 120 }
@@ -444,36 +444,6 @@ where
444 return false; 444 return false;
445 } 445 }
446 446
447 if resolved_res.reached_fixedpoint != ReachedFixedPoint::Yes {
448 let crate_name = &path.segments[0].name;
449
450 // FIXME:
451 // $crate are not handled in resolver right now
452 if crate_name.to_string() == "$crate" {
453 return true;
454 }
455
456 // FIXME:
457 // Currently `#[cfg(test)]` are ignored and cargo-metadata do not insert
458 // dev-dependencies of dependencies. For example,
459 // if we depend on parking lot, and parking lot has a dev-dependency on lazy_static.
460 // Then `lazy_static` wil not included in `CrateGraph`
461 // We can fix that by proper handling `cfg(test)`.
462 //
463 // So right now we set the fixpoint to No only if its crate is in CrateGraph
464 // See issue #1282 for details
465 let krate =
466 match self.def_map.resolve_name_in_extern_prelude(crate_name).take_types() {
467 Some(ModuleDef::Module(m)) => m.krate(self.db),
468 _ => return true,
469 };
470 if krate.is_none() {
471 return true;
472 }
473
474 res = resolved_res.reached_fixedpoint;
475 }
476
477 true 447 true
478 }); 448 });
479 449