rust-analyzer/crates
bors 501b1fa594 Auto merge of #17457 - roife:remove-circle, r=Veykril
fix: ensure there are no cycles in the source_root_parent_map

See #17409

We can view the connections between roots as a graph. The problem is that this graph may contain cycles, so when adding edges, it is necessary to check whether it will lead to a cycle.

Since we ensure that each node has at most one outgoing edge (because each SourceRoot can have only one parent), we can use a disjoint-set to maintain the connectivity between nodes. If an edge’s two nodes belong to the same set, they are already connected.

Additionally, this PR includes the following three changes:

1. Removed the workaround from #17409.
2. Added an optimization: If `map.contains_key(&SourceRootId(*root_id as u32))`, we can skip the current loop iteration since we have already found its parent.
3. Modified the inner loop to iterate in reverse order with `roots[..idx].iter().rev()` at line 319. This ensures that if we are looking for the parent of `a/b/c`, and both `a` and `a/b` meet the criteria, we will choose the longer match (`a/b`).
2024-06-20 07:53:57 +00:00
..
base-db chore: Prefer tracing span shorthand macros 2024-06-06 16:52:25 -07:00
cfg fix: Fix doc comment desugaring for proc-macros 2024-04-27 13:30:51 +02:00
flycheck Auto merge of #17315 - hamirmahal:style/simplify-string-interpolation, r=Veykril 2024-06-03 12:29:27 +00:00
hir Add tactic for associated item constants 2024-06-18 22:08:44 +03:00
hir-def fix: Fix pat fragment parsers choking on <eoi> 2024-06-17 19:42:56 +02:00
hir-expand Auto merge of #17439 - Veykril:paralleler-prime-caches, r=Veykril 2024-06-17 15:58:09 +00:00
hir-ty Merge from rust-lang/rust 2024-06-20 08:03:36 +03:00
ide Auto merge of #17426 - roife:fix-issue-17420, r=Veykril 2024-06-19 08:13:18 +00:00
ide-assists Add tactic for associated item constants 2024-06-18 22:08:44 +03:00
ide-completion fix(completion): complete async keyword 2024-06-19 11:12:24 -07:00
ide-db Auto merge of #17439 - Veykril:paralleler-prime-caches, r=Veykril 2024-06-17 15:58:09 +00:00
ide-diagnostics fix: Only show unlinked-file diagnostic on first line during startup 2024-06-13 11:52:34 -07:00
ide-ssr Thread more HasSource::source calls through Semantics for caching 2024-06-10 10:33:07 +02:00
intern Fix new clippy lints 2024-04-01 17:55:56 +02:00
limit Simplify 2024-04-06 13:12:07 +02:00
load-cargo fix: ensure there are no cycles in the source_root_parent_map 2024-06-20 13:46:14 +08:00
mbe Auto merge of #17398 - Veykril:bogus-file, r=Veykril 2024-06-12 07:19:31 +00:00
parser fix: Fix pat fragment parsers choking on <eoi> 2024-06-17 19:42:56 +02:00
paths Apply requested changes round 2 2024-06-05 10:45:22 +02:00
proc-macro-api Register virtual workspace Cargo.toml files in the VFS 2024-06-09 12:54:50 +02:00
proc-macro-srv Auto merge of #16257 - lnicola:rustc-check-cfg, r=Veykril 2024-04-18 12:13:06 +00:00
proc-macro-srv-cli Auto merge of #16257 - lnicola:rustc-check-cfg, r=Veykril 2024-04-18 12:13:06 +00:00
profile Fix typos 2024-05-15 18:55:27 +02:00
project-model feature: add build system info; runnables to rust-project.json 2024-06-11 11:55:17 -04:00
rust-analyzer fix: ensure there are no cycles in the source_root_parent_map 2024-06-20 13:46:14 +08:00
salsa Auto merge of #17417 - Wilfred:intern_macros_salsa, r=Veykril 2024-06-14 06:20:26 +00:00
sourcegen Fix new clippy lints 2024-04-01 17:55:56 +02:00
span internal: Fix rustdoc warnings 2024-06-13 17:29:10 -07:00
stdx internal: Fix rustdoc warnings 2024-06-13 17:29:10 -07:00
syntax Update lib.rs 2024-06-18 00:52:53 +01:00
test-fixture style: simplify string interpolation 2024-05-30 16:18:49 -07:00
test-utils internal: Fix rustdoc warnings 2024-06-13 17:29:10 -07:00
text-edit Merge commit 'ddf105b646' into sync-from-ra 2024-02-11 08:40:19 +02:00
toolchain internal: Fix rustdoc warnings 2024-06-13 17:29:10 -07:00
tt Cleanup some inert attribute stuff 2024-06-04 12:38:20 +02:00
vfs internal: Remove FileId::BOGUS 2024-06-12 08:16:07 +02:00
vfs-notify discard when the path is invalid utf8 symbol. 2024-04-30 15:39:05 +08:00