This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit a6ddf5f
committed
Auto merge of rust-lang#16961 - Wilfred:fix_crate_ids, r=Veykril
Fix crate IDs when multiple workspaces are loaded
Previously, we assumed that the crate numbers in a `rust-project.json` always matched the `CrateId` values in the crate graph. This isn't true when there are multiple workspaces, because the crate graphs are merged and the `CrateId` values in the merged graph are different.
This broke flycheck (see first commit), because we were unable to find the workspace when a file changed, so we every single flycheck, producing duplicate compilation errors.
Instead, use the crate root module path to look up the relevant flycheck. This makes `ProjectWorkspace::Json` consistenet with `ProjectWorkspace::Cargo`.
Also, define a separate JSON crate number type, to prevent bugs like this happening again.File tree
3 files changed
+32
-37
lines changed- crates
- project-model/src
- rust-analyzer/src/handlers
3 files changed
+32
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| |||
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
| 76 | + | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
| 79 | + | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
128 | 127 | | |
129 | 128 | | |
130 | 129 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 130 | + | |
141 | 131 | | |
142 | 132 | | |
143 | 133 | | |
| |||
161 | 151 | | |
162 | 152 | | |
163 | 153 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 154 | + | |
| 155 | + | |
169 | 156 | | |
170 | 157 | | |
171 | 158 | | |
| |||
188 | 175 | | |
189 | 176 | | |
190 | 177 | | |
191 | | - | |
| 178 | + | |
192 | 179 | | |
193 | 180 | | |
194 | 181 | | |
| |||
227 | 214 | | |
228 | 215 | | |
229 | 216 | | |
230 | | - | |
231 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
232 | 227 | | |
233 | 228 | | |
234 | | - | |
| 229 | + | |
235 | 230 | | |
236 | | - | |
| 231 | + | |
237 | 232 | | |
238 | 233 | | |
239 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
881 | | - | |
| 881 | + | |
| 882 | + | |
882 | 883 | | |
883 | | - | |
| 884 | + | |
884 | 885 | | |
885 | 886 | | |
886 | | - | |
| 887 | + | |
887 | 888 | | |
888 | 889 | | |
889 | 890 | | |
| |||
939 | 940 | | |
940 | 941 | | |
941 | 942 | | |
942 | | - | |
| 943 | + | |
943 | 944 | | |
944 | 945 | | |
945 | 946 | | |
946 | 947 | | |
947 | | - | |
948 | | - | |
| 948 | + | |
| 949 | + | |
949 | 950 | | |
950 | 951 | | |
951 | 952 | | |
| |||
954 | 955 | | |
955 | 956 | | |
956 | 957 | | |
957 | | - | |
958 | | - | |
| 958 | + | |
| 959 | + | |
959 | 960 | | |
960 | 961 | | |
961 | 962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
303 | 302 | | |
304 | 303 | | |
305 | 304 | | |
| |||
0 commit comments