about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/graph/scc/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-04-28Use associated types for SCC annotations, per code review suggestionAmanda Stjerna-37/+33
2025-04-28Decouple SCC annotations from SCCsAmanda Stjerna-66/+66
This rewires SCC annotations to have them be a separate, visitor-type data structure. It was broken out of #130227, which needed them to be able to remove unused annotations after computation without recomputing the SCCs themselves. As a drive-by it also removes some redundant code from the hot loop in SCC construction for a performance improvement.
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-1/+1
2025-02-22Fix overcapturing, unsafe extern blocks, and new unsafe opsMichael Goulet-1/+1
2025-01-26Incorporate `iter_nodes` into `graph::DirectedGraph`Zalathar-2/+2
This assumes that the set of valid node IDs is exactly `0..num_nodes`. In practice, we have a lot of graph-algorithm code that already assumes that nodes are densely numbered, by using `num_nodes` to allocate per-node indexed data structures.
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-1/+1
2024-08-11Use assert_matches around the compilerMichael Goulet-1/+2
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-12Address code review comments on the commentsAmanda Stjerna-1/+4
2024-06-12Revise documentation after @lqd's commentsAmanda Stjerna-8/+4
2024-06-12Remove a few unnecessary constructionsAmanda Stjerna-4/+7
This shaves off ca 6% of the cycles in `start_walk_from()` in my experiments.
2024-06-12Slightly faster version of `find_state`Amanda Stjerna-24/+27
This version shaves off ca 2% of the cycles in my experiments and makes the control flow easier to follow for me and hopefully others, including the compiler. Someone gave me a working profiler and by God I'm using it.
2024-06-12Docstring for for `Annotation`Amanda Stjerna-2/+12
Note that this changes no executing code. The change is 100% in documentation.
2024-06-12Formatting, weird because I just did thatAmanda Stjerna-2/+3
2024-06-12Simplify path compression logicAmanda Stjerna-17/+2
2024-06-12Documentation fixesAmanda Stjerna-8/+7
2024-06-12Extend SCC construction to enable extra functionalityAmanda Stjerna-122/+265
This patch has been extracted from #123720. It specifically enhances `Sccs` to allow tracking arbitrary commutative properties of SCCs, including - reachable values (max/min) - SCC-internal values (max/min) This helps with among other things universe computation: we can now identify SCC universes as a straightforward "find max/min" operation during SCC construction. It's also more or less zero-cost; don't use the new features, don't pay for them. This commit also vastly extends the documentation of the SCCs module, which I had a very hard time following.
2024-05-30Apply x clippy --fix and x fmtr0cky-1/+1
2024-05-08Remove `extern crate tracing`.Nicholas Nethercote-0/+1
`use` is a nicer way of doing things.
2024-04-15Use RPITIT for `Successors` and `Predecessors` traitsMaybe Waffle-3/+1
Now with RPITIT instead of GAT!
2024-04-14Rename `WithNumEdges` => `NumEdges` and `WithStartNode` => `StartNode`Maybe Waffle-2/+2
2024-04-14Merge `{With,Graph}{Successors,Predecessors}` into `{Successors,Predecessors}`Maybe Waffle-11/+7
Now with GAT!
2024-04-14Merge `WithNumNodes` into DirectedGraphMaybe Waffle-8/+6
2023-11-28Avoid an unnecessary `by_ref`.Nicholas Nethercote-1/+1
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-3/+3
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-02-21address reviewb-naber-4/+20
2023-02-19sccs infob-naber-5/+5
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-8/+6
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2021-12-22rustc `VecGraph`: require the index type to implement Ordpierwill-3/+4
2021-12-05Stop enabling `in_band_lifetimes` in rustc_data_structuresScott McMurray-1/+1
There's a conversation in the tracking issue about possibly unaccepting `in_band_lifetimes`, but it's used heavily in the compiler, and thus there'd need to be a bunch of PRs like this if that were to happen. So here's one to see how much of an impact it has. (Oh, and I removed `nll` while I was here too, since it didn't seem needed. Let me know if I should put that back.)
2021-09-28More tracing instrumentationOli Scherer-14/+6
2021-09-24consistent big O notationr00ster91-1/+1
2020-12-29don't redundantly repeat field namesMatthias Krüger-1/+1
2020-11-08Remove recursion from sccc walkingAndreas Molzer-73/+182
This allows constructing the sccc for large that visit many nodes before finding a single cycle of sccc, for example lists. When used to find dependencies in borrow checking the list case is what occurs in very long functions.
2020-11-05Convert the recursive find_state to a loopAndreas Molzer-22/+110
The basic conversion is a straightforward conversion of the linear recursion to a loop forwards and backwards propagation of the result. But this uses an optimization to avoid the need for extra space that would otherwise be necessary to store the stack of unfinished states as the function is not tail recursive. Observe that only non-root-nodes in cycles have a recursive call and that every such call overwrites their own node state. Thus we reuse the node state itself as temporary storage for the stack of unfinished states by inverting the links to a chain back to the previous state update. When we hit the root or end of the full explored chain we propagate the node state update backwards by following the chain until a node with a link to itself.
2020-10-30Fix even more clippy warningsJoshua Nelson-4/+1
2020-08-30mv compiler to compiler/mark-0/+380