diff options
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/server_world.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs index 4f3c231d3..d5dbf999f 100644 --- a/crates/ra_lsp_server/src/server_world.rs +++ b/crates/ra_lsp_server/src/server_world.rs | |||
@@ -73,7 +73,9 @@ impl ServerWorldState { | |||
73 | if let (Some(&from), Some(&to)) = | 73 | if let (Some(&from), Some(&to)) = |
74 | (sysroot_crates.get(&from), sysroot_crates.get(&to)) | 74 | (sysroot_crates.get(&from), sysroot_crates.get(&to)) |
75 | { | 75 | { |
76 | crate_graph.add_dep(from, name.clone(), to); | 76 | if let Err(_) = crate_graph.add_dep(from, name.clone(), to) { |
77 | log::error!("cyclic dependency between sysroot crates") | ||
78 | } | ||
77 | } | 79 | } |
78 | } | 80 | } |
79 | } | 81 | } |
@@ -108,11 +110,20 @@ impl ServerWorldState { | |||
108 | for &from in pkg_crates.get(&pkg).into_iter().flatten() { | 110 | for &from in pkg_crates.get(&pkg).into_iter().flatten() { |
109 | if let Some(to) = lib_tgt { | 111 | if let Some(to) = lib_tgt { |
110 | if to != from { | 112 | if to != from { |
111 | crate_graph.add_dep(from, pkg.name(&ws.cargo).into(), to); | 113 | if let Err(_) = |
114 | crate_graph.add_dep(from, pkg.name(&ws.cargo).into(), to) | ||
115 | { | ||
116 | log::error!( | ||
117 | "cyclic dependency between targets of {}", | ||
118 | pkg.name(&ws.cargo) | ||
119 | ) | ||
120 | } | ||
112 | } | 121 | } |
113 | } | 122 | } |
114 | if let Some(std) = libstd { | 123 | if let Some(std) = libstd { |
115 | crate_graph.add_dep(from, "std".into(), std); | 124 | if let Err(_) = crate_graph.add_dep(from, "std".into(), std) { |
125 | log::error!("cyclic dependency on std for {}", pkg.name(&ws.cargo)) | ||
126 | } | ||
116 | } | 127 | } |
117 | } | 128 | } |
118 | } | 129 | } |
@@ -123,7 +134,13 @@ impl ServerWorldState { | |||
123 | for dep in pkg.dependencies(&ws.cargo) { | 134 | for dep in pkg.dependencies(&ws.cargo) { |
124 | if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) { | 135 | if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) { |
125 | for &from in pkg_crates.get(&pkg).into_iter().flatten() { | 136 | for &from in pkg_crates.get(&pkg).into_iter().flatten() { |
126 | crate_graph.add_dep(from, dep.name.clone(), to); | 137 | if let Err(_) = crate_graph.add_dep(from, dep.name.clone(), to) { |
138 | log::error!( | ||
139 | "cyclic dependency {} -> {}", | ||
140 | pkg.name(&ws.cargo), | ||
141 | dep.pkg.name(&ws.cargo) | ||
142 | ) | ||
143 | } | ||
127 | } | 144 | } |
128 | } | 145 | } |
129 | } | 146 | } |