-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive for circularity #307
Comments
Hi @pdh11 thanks for the bug report!
You are absolutely right in that this is unexpected and feels wrong. This is caused by This is definitely a bug! That said adding The project heavily relies on snapshot testing as Both, the snapshot tests, as well as GraphViz require nodes to have unique ids assigned to them. While effectively every object from For this to work properly —afaict— one would have to first add |
Sheer spitballing here -- I confess I haven't looked at how either cargo-modules or rust-analyzer actually work -- but wouldn't, say, the identifier full-path-of-trait + |
Trait impls aren't the real culprit here, I'm not saying it's impossible, but getting stable identifiers for nodes and edges has been one of the thorniest bits of All the HIR types provided by Since the main problem is with the identifiers one simply use the id-map approach outlined above for the The one main drawback from a user's perspective with this workaround is that diffing output of |
In this example:
it seems pretty clear that the reasonable assessment is that module "bar" depends on module "foo", but not vice versa. Yet
cargo modules dependencies --no-traits --no-types --no-fns --layout circo
shows a cyclic "uses"-dependency:Without the --no-traits --no-types --no-fns it's clear what happened: the trait in
mod bar
has a function which uses typebar::Fnord
-- and that function is depicted as "owned by" foo just because it's implemented on a struct which is owned by foo:This is unhelpful, IMO: the example (distilled from a much larger one, of course) has in fact been written with all due principles of levelisability and non-circularity in mind, but cargo-modules (v0.16.6) produces a "false positive" for circularity.
The text was updated successfully, but these errors were encountered: