-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
In this example:
pub mod foo {
pub struct Foo {}
}
pub mod bar {
use crate::foo::Foo;
pub struct Fnord;
pub trait Bar {
fn send(&self, n: Fnord);
}
impl Bar for Foo {
fn send(&self, _: Fnord) {}
}
}
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 type bar::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.
Metadata
Metadata
Assignees
Labels
No labels