diff options
author | Aleksey Kladov <[email protected]> | 2019-01-13 09:27:26 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-13 10:39:48 +0000 |
commit | 77f67ca7e2caac6d94215834981ae3f6fb908443 (patch) | |
tree | 6047b4e5101e39af9837f2e3192c4e29d94b7b96 /crates/ra_hir/src/nameres | |
parent | 40686722ba0762c4af396da120331710edfeabe8 (diff) |
gracefully handle cycles in crate graph
rust-lang/rust has absolutely weird setup with rustc-workspace-shim,
which leads to real cycles.
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index ba9fcb3d1..647fd92aa 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -235,7 +235,9 @@ fn item_map_across_crates() { | |||
235 | let mut crate_graph = CrateGraph::default(); | 235 | let mut crate_graph = CrateGraph::default(); |
236 | let main_crate = crate_graph.add_crate_root(main_id); | 236 | let main_crate = crate_graph.add_crate_root(main_id); |
237 | let lib_crate = crate_graph.add_crate_root(lib_id); | 237 | let lib_crate = crate_graph.add_crate_root(lib_id); |
238 | crate_graph.add_dep(main_crate, "test_crate".into(), lib_crate); | 238 | crate_graph |
239 | .add_dep(main_crate, "test_crate".into(), lib_crate) | ||
240 | .unwrap(); | ||
239 | 241 | ||
240 | db.set_crate_graph(crate_graph); | 242 | db.set_crate_graph(crate_graph); |
241 | 243 | ||
@@ -288,7 +290,9 @@ fn import_across_source_roots() { | |||
288 | let mut crate_graph = CrateGraph::default(); | 290 | let mut crate_graph = CrateGraph::default(); |
289 | let main_crate = crate_graph.add_crate_root(main_id); | 291 | let main_crate = crate_graph.add_crate_root(main_id); |
290 | let lib_crate = crate_graph.add_crate_root(lib_id); | 292 | let lib_crate = crate_graph.add_crate_root(lib_id); |
291 | crate_graph.add_dep(main_crate, "test_crate".into(), lib_crate); | 293 | crate_graph |
294 | .add_dep(main_crate, "test_crate".into(), lib_crate) | ||
295 | .unwrap(); | ||
292 | 296 | ||
293 | db.set_crate_graph(crate_graph); | 297 | db.set_crate_graph(crate_graph); |
294 | 298 | ||
@@ -330,7 +334,9 @@ fn reexport_across_crates() { | |||
330 | let mut crate_graph = CrateGraph::default(); | 334 | let mut crate_graph = CrateGraph::default(); |
331 | let main_crate = crate_graph.add_crate_root(main_id); | 335 | let main_crate = crate_graph.add_crate_root(main_id); |
332 | let lib_crate = crate_graph.add_crate_root(lib_id); | 336 | let lib_crate = crate_graph.add_crate_root(lib_id); |
333 | crate_graph.add_dep(main_crate, "test_crate".into(), lib_crate); | 337 | crate_graph |
338 | .add_dep(main_crate, "test_crate".into(), lib_crate) | ||
339 | .unwrap(); | ||
334 | 340 | ||
335 | db.set_crate_graph(crate_graph); | 341 | db.set_crate_graph(crate_graph); |
336 | 342 | ||